TableCache<T> class

Constructors

TableCache({required String tableName, required RowDecoder<T> decoder, bool isEvent = false})

Properties

decoder → RowDecoder<T>
final
hashCode → int
The hash code for this object.
no setterinherited
hasPrimaryKey → bool
final
isEvent → bool
final
isSubscribed → bool
no setter
lastBatch → ValueNotifier<TransactionBatch<T>?>
final
onDelete → Stream<TableDeleteEvent<T>>
Fires when a row is deleted from this table. See onInsert for broadcast/ordering semantics.
no setter
onInsert → Stream<TableInsertEvent<T>>
Fires when a row is inserted into this table. Broadcast — multiple subscribers each receive every event. No replay: late subscribers do not see past events. Fires synchronously during the transaction, before lastBatch fires.
no setter
onUpdate → Stream<TableUpdateEvent<T>>
Fires when a row is updated. oldRow and newRow are both provided on the event. See onInsert for broadcast/ordering semantics.
no setter
ownerEntryCount → int
no setter
ownershipImbalanceCount → int
no setter
primaryKeys → Set
no setter
rows → ValueNotifier<List<T>>
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
subscribed → Future<void>
Resolves when the server has delivered the initial subscription batch for this table. Completes exactly once; stays completed across reconnects. Resolves even for empty tables (no row-count gate). Throws SpacetimeDbSubscriptionException if the server rejects a subscription query that references this table by name.
no setter
tableName → String
final

Methods

applyDeletes(BsatnRowList deletes) → void
applyInitialData(BsatnRowList inserts, EventContext context, {Set? protectedKeys}) → Set
Apply initial subscription data with event context
applyServerDelta(BsatnRowList deletes, BsatnRowList inserts, EventContext context, {required int querySetId, Set? protectedKeys, bool reconcile = false, bool trackImbalance = true, void onProtectedKeyCommitted(dynamic primaryKey, Map<String, dynamic>? committedRowJson)?, void onOwnershipGained(dynamic primaryKey)?}) → Set
applySnapshot(BsatnRowList inserts, EventContext context, {required int querySetId, Set? protectedKeys, bool reconnectInFlight = false}) → Set
applyTransactionUpdate(BsatnRowList deletes, BsatnRowList inserts, EventContext context, {Set? protectedKeys, bool reconcile = false}) → void
Apply transaction update with event context
applyTransactionUpdateAndCollectKeys(BsatnRowList deletes, BsatnRowList inserts, EventContext context, {Set? protectedKeys, bool reconcile = false, void onProtectedKeyCommitted(dynamic primaryKey, Map<String, dynamic>? committedRowJson)?}) → Set
Apply transaction update and return the set of touched primary keys
clear() → void
Clears all rows from the cache
clearNoPkRequestTag(String requestId) → void
clearOwners() → void
clearUntaggedNoPkRows() → void
count() → int
Returns the number of rows in the cache
deleteRow(dynamic primaryKey) → void
dispose() → void
dropQuerySet(int querySetId, {Set? protectedKeys}) → void
emitBatch(List<TableEventSpec> specs, EventContext context) → void
find(dynamic primaryKey) → T?
Finds a row by its primary key
getRow(dynamic primaryKey) → T?
insertRow(T row, {String? requestId}) → void
insertServerOwnedRow(T row, {int querySetId = 0}) → void
iter() → Iterable<T>
Returns an iterable of all rows in the cache
loadFromSerializable(List<Map<String, dynamic>> jsonRows) → void
markSubscribed() → void
markSubscribeFailed(Object error) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ownedKeys(dynamic primaryKey) → Set
removeNoPkRow(Map<String, dynamic> rowJson, {String? requestId}) → void
removeRowsWhere(bool test(dynamic pk)) → void
rowNotifier(dynamic primaryKey) → ValueNotifier<T?>
Returns a ValueNotifier that fires only when the row with this primaryKey changes. Fires when the row's value changes per == — a server touch that doesn't change any field is de-duplicated.
toSerializable({List<Map<String, dynamic>> excludeRows = const [], Set<String> excludeRequestIds = const {}}) → List<Map<String, dynamic>>
toString() → String
A string representation of this object.
inherited
updateRow(T row) → void

Operators

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