ClientCache class
Main cache container for all subscribed tables.
Tables are created eagerly when their decoder is registered via
registerDecoder. The primary key is the table name — tableId is a
protocol-layer concern only and never leaves the message-decoding layer.
Example:
final cache = ClientCache();
cache.registerDecoder<Note>('note', NoteDecoder());
cache.registerDecoder<User>('user', UserDecoder());
final noteTable = cache.getTableByTypedName<Note>('note');
final note = noteTable.find(42);
for (final note in noteTable.iter()) {
print(note.title);
}
Constructors
Properties
-
activatedTableNames
→ List<
String> -
Names of all tables with registered decoders.
no setter
-
allTables
→ Iterable<
TableCache> -
All table caches in the registry.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
registeredTableNames
→ Iterable<
String> -
Names of all tables with registered decoders.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tableCount → int
-
Number of registered tables.
no setter
Methods
-
clearAll(
) → void - Clear all cached rows while keeping registrations intact.
-
getTableByName(
String tableName) → TableCache? - Get a table cache by name without enforcing a type parameter.
-
getTableByTypedName<
T> (String tableName) → TableCache< T> - Get a typed table cache by table name.
-
hasBuilder(
String tableName) → bool -
Whether a decoder has been registered for
tableName. -
isEventTable(
String tableName) → bool -
loadSerializedTables(
Map< String, List< data) → voidMap< >String, dynamic> > -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerDecoder<
T> (String tableName, RowDecoder< T> decoder, {bool isEvent = false}) → void - Register a decoder for a table or view.
-
serializeAllTables(
) → Map< String, List< Map< >String, dynamic> > -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited