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
-
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.
oldRowandnewRoware both provided on the event. See onInsert for broadcast/ordering semantics.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}) → void - Apply initial subscription data with event context
-
applyInserts(
BsatnRowList inserts) → void -
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}) → Set - Apply transaction update and return the set of touched primary keys
-
clear(
) → void - Clears all rows from the cache
-
count(
) → int - Returns the number of rows in the cache
-
deleteRow(
dynamic primaryKey) → void -
dispose(
) → 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) → void -
iter(
) → Iterable< T> - Returns an iterable of all rows in the cache
-
loadFromSerializable(
List< Map< jsonRows) → voidString, dynamic> > -
markSubscribed(
) → void -
markSubscribeFailed(
Object error) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeRowsWhere(
bool test(dynamic pk)) → void -
rowNotifier(
dynamic primaryKey) → ValueNotifier< T?> -
Returns a ValueNotifier that fires only when the row with this
primaryKeychanges. 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> > -
toString(
) → String -
A string representation of this object.
inherited
-
updateRow(
T row) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited