SubscriptionManager class

Constructors

SubscriptionManager(SpacetimeDbConnection _connection, {OfflineStorage? offlineStorage, OfflineQueuePolicy queuePolicy = const OfflineQueuePolicy(), bool retainRowsOnUnsubscribe = false})

Properties

activeSubscriptionQueries → Set<String>
All currently-subscribed query strings across every active QuerySetId.
no setter
address → String?
no setter
cache → ClientCache
final
consecutiveEvictionSkips → int
How many reconnects in a row abandoned their ownership generation without finalizing. Anything above zero means rows are being carried forward unreconciled; a climbing value means the cache is not converging.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasOfflineStorage → bool
no setter
identity → Identity?
no setter
onInitialConnection → Stream<InitialConnectionMessage>
no setter
onMutationSyncResult → Stream<MutationSyncResult>
no setter
onOneOffQueryResult → Stream<OneOffQueryResult>
no setter
onProcedureResult → Stream<ProcedureResultMessage>
no setter
onReducerResult → Stream<ReducerResultMessage>
no setter
onSubscribeApplied → Stream<SubscribeApplied>
no setter
onSubscriptionError → Stream<SubscriptionErrorMessage>
no setter
onSyncStateChanged → Stream<SyncState>
no setter
onTransactionUpdate → Stream<TransactionUpdateMessage>
no setter
onUnsubscribeApplied → Stream<UnsubscribeApplied>
no setter
reducerEmitter → ReducerEmitter
final
reducerRegistry → ReducerRegistry
final
reducers ↔ ReducerCaller
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
subscriptionsByQuerySetId → Map<int, List<String>>
no setter
subscriptionsReady → ValueListenable<bool>
True only when the connection is open AND every active query set has had its SubscribeApplied fully applied to the cache — i.e. the connection is genuinely usable, not merely socket-open. Latches back to false the moment the socket drops or a reconnect begins resubscribing, and returns to true when the resubscribe completes. Consumers should treat "connected but not ready" as still-connecting.
no setter
syncState → SyncState
no setter

Methods

callProcedure(String procedureName, Uint8List args, {int requestId = 0}) → void
checkHealth({Duration timeout = const Duration(seconds: 3)}) → Future<bool>
Probe whether the server is actually answering on this socket.
clearAllPendingMutations() → Future<void>
clearPendingMutation(String requestId) → Future<void>
clearSyncErrors() → void
dispose() → Future<void>
forgetQuerySet(int querySetId) → bool
getPendingMutations() → Future<List<PendingMutation>>
loadFromOfflineCache() → Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
oneOffQuery(String query, {int requestId = 0}) → void
optimisticKeysFor(String tableName) → Set
rowProvenanceCountForTable(String tableName) → int
subscribe(List<String> queries) → Future<int>
Subscribe a new query set. Returns the assigned querySetId. Awaits the matching SubscribeApplied so initial rows are in the cache. Resolves without throwing if the manager is disposed, the connection drops, or the server rejects the subscription before then.
syncPendingMutations() → Future<void>
toString() → String
A string representation of this object.
inherited
unsubscribe(int querySetId, {int requestId = 0, bool sendDroppedRows = false}) → void
Remove a subscription. Set sendDroppedRows: true to receive the dropped-row payload on the resulting UnsubscribeApplied (slice 5 / v2.rs:86-93). The default is false — server sends no dropped rows.

Operators

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

Static Methods

computeQuerySetHash(Iterable<String> queries) → int
Stable hash identifying a query set by its content: each query is trimmed and internal whitespace runs collapse to one space (case is preserved — SQL string literals are case-sensitive), the normalized list is sorted, and FNV-1a 32-bit runs over the joined result. The same queries in any order always produce the same hash, across process restarts.