Adopture Docs
SDKsFlutter

Offline Support

How the Adopture SDK handles offline scenarios and event delivery.

The Adopture SDK is designed to work reliably in offline and poor network conditions. Events are never lost, even if the user has no connectivity.

Local Storage

All events are stored in a local SQLite database before being sent to the server. This ensures events persist across app restarts and are not lost if the app is terminated unexpectedly.

Automatic Retry

When the network is unavailable, events remain in the local queue. The SDK automatically retries delivery when connectivity is restored.

Batch Sending

Events are sent in batches of up to 100 events per request, reducing network overhead and battery usage.

Retry Logic

Failed requests are retried with the following strategy:

  • Up to 5 retry attempts per batch
  • Exponential backoff with jitter between retries (maximum 30 seconds between attempts)
  • The SDK respects server rate limit headers (Retry-After) when present

Queue Management

  • Default maximum queue size: 1,000 events
  • When the queue is full, the oldest events are dropped to make room for new ones
  • Configure the queue size with maxQueueSize in Adopture.init():
await Adopture.init(
  appKey: 'ak_your_app_key_here',
  maxQueueSize: 5000, // Store up to 5,000 events locally
);

Manual Flush

Send all queued events immediately:

await Adopture.flush();

Background Flush

When the app moves to the background, the SDK automatically attempts to flush all queued events. This ensures events are delivered even if the user does not return to the app.

Idempotency

Each request includes an Idempotency-Key header to prevent duplicate event processing on the server. If a request is retried due to a network failure, the server recognizes the duplicate and discards it.

On this page