OfflineQueuePolicy class

Controls how the offline mutation queue accepts and replays mutations.

The default policy preserves the SDK's original behavior exactly: no age limit, no queue bound, every queued mutation replays on reconnect.

  • maxMutationAge: mutations older than this at flush time are discarded (optimistic changes rolled back, surfaced as a failed MutationSyncResult with expired: true) instead of replayed.
  • maxQueueLength: enqueue-time bound. At the limit, overflow decides: rejectNew throws SpacetimeDbQueueFullException before any optimistic change is applied; dropOldest evicts and rolls back the oldest queued mutation to make room.
  • onBeforeReplay: per-mutation veto called at flush time. Returning ReplayDecision.discard drops the mutation through the same surfaced path as expiry. Must be fast; it runs on the sync path.
  • maxRetainedFailures: how many recent failed MutationSyncResults SyncState.recentFailures keeps for UIs to display. failedCount always reflects the true total regardless of this bound. null retains every failure (unbounded); the default keeps the most recent 20.

Constructors

OfflineQueuePolicy({Duration? maxMutationAge, int? maxQueueLength, OverflowStrategy overflow = OverflowStrategy.rejectNew, FutureOr<ReplayDecision> onBeforeReplay(PendingMutation mutation)?, int? maxRetainedFailures = 20})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
maxMutationAge Duration?
final
maxQueueLength int?
final
maxRetainedFailures int?
final
onBeforeReplay FutureOr<ReplayDecision> Function(PendingMutation mutation)?
final
overflow OverflowStrategy
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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