OfflineSyncManager class final

Coordinates a persistent, strict-FIFO offline operation queue.

Calls that access the store are serialized. A retry at the head of the queue blocks newer work so server-side ordering remains deterministic.

Constructors

OfflineSyncManager({required SyncStore store, required SyncProcessor processor, SyncConnectivity connectivity = const AlwaysOnlineSyncConnectivity(), SyncRetryPolicy? retryPolicy, bool autoSync = true, bool disposeConnectivity = true, SyncClock? clock})
Creates a manager.

Properties

autoSync bool
Whether enqueue, reconnection, and timers trigger synchronization.
final
disposeConnectivity bool
Whether dispose also disposes the supplied connectivity source.
final
events Stream<SyncEvent>
Broadcast stream of queue lifecycle events.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() Future<void>
Removes all pending operations.
dispose() Future<void>
Cancels timers, closes storage, and releases event resources.
enqueue({String? id, required String action, Map<String, Object?> payload = const <String, Object?>{}}) Future<SyncOperation>
Builds and appends an operation to the end of the FIFO queue.
enqueueOperation(SyncOperation operation) Future<void>
Appends an existing operation to the end of the FIFO queue.
initialize({bool syncOnStart = true}) Future<void>
Initializes storage and connectivity listeners.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pendingOperations() Future<List<SyncOperation>>
Returns a snapshot of pending operations in FIFO order.
remove(String id) Future<bool>
Removes a queued operation by ID and reports whether it existed.
synchronize() Future<SyncReport>
Runs one serialized synchronization pass.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited