dynos_sync library
A local-first, offline-capable sync engine.
Backend and database agnostic — implement LocalStore, RemoteStore, and QueueStore for your stack, or use the provided Drift and Supabase adapters.
import 'package:dynos_sync/dynos_sync.dart'; // core
import 'package:dynos_sync/drift.dart'; // Drift adapters
import 'package:dynos_sync/supabase.dart'; // Supabase adapter
Classes
- InMemoryTimestampStore
- In-memory timestamp store.
- IsolateSyncEngine
- A wrapper for SyncEngine that runs heavy sync operations in a background isolate.
- LocalStore
- Interface for the local database (Drift, Hive, Isar, raw SQLite, etc.).
- QueueStore
- Interface for the local sync queue storage.
- RemoteStore
- Interface for the remote backend (Supabase, Firebase, custom REST, etc.).
- SyncAuthRequired
- Emitted when the remote server rejects the request due to authentication.
- SyncConfig
- Configuration for the sync engine.
- SyncConflict
- Emitted when a conflict between local and remote data is detected and resolved.
- SyncDrainComplete
- Emitted when the local outbound queue has been fully drained.
- SyncEngine
- A local-first, offline-capable sync engine.
- SyncEntry
- A single queued sync operation waiting to be pushed to the remote.
- SyncError
- Emitted when an unexpected error occurs during a sync operation.
- SyncEvent
- Base class for all sync lifecycle events.
- SyncPoisonPill
- Emitted when a sync entry exceeds its maximum retry count and is discarded.
- SyncPullComplete
- Emitted when a pull operation for a table completes successfully.
- SyncRetryScheduled
- Emitted when a failed sync entry is scheduled for a later retry.
- TimestampStore
- Interface for persisting per-table sync timestamps locally.
Enums
- ConflictStrategy
- Strategy for resolving conflicts during pull.
- SyncOperation
- The type of sync operation queued for push.
Typedefs
Exceptions / Errors
- AuthExpiredException
- Thrown by RemoteStore when the auth token is expired or invalid (HTTP 401/403).
- PayloadTooLargeException
- Thrown when a payload exceeds SyncConfig.maxPayloadBytes.
- RlsViolationException
- Thrown when a pulled row's user_id doesn't match the engine's userId.
- SyncDeserializationException
- Thrown when a remote response cannot be deserialized.
- SyncRemoteException
- Thrown when the remote returns HTTP 200 but with an empty body or error payload.