getTableByTypedName<T> method
Get a typed table cache by table name.
Returns a table with zero rows if the decoder was registered but no
data has arrived yet. Throws ArgumentError if no decoder was
registered for tableName.
Implementation
TableCache<T> getTableByTypedName<T>(String tableName) {
final table = _tables[tableName];
if (table == null) {
throw ArgumentError(
'Table "$tableName" has no registered decoder. '
'Call registerDecoder<$T>("$tableName", ...) before accessing it.',
);
}
if (table is! TableCache<T>) {
throw StateError(
"Type Mismatch: You requested TableCache<$T> for table '$tableName', "
"but the active cache is ${table.runtimeType}. "
"Ensure you are using the correct generated class for this table.",
);
}
return table;
}