get<T> method
Returns a single entity of type T matching the afterWhere clause, or
null when no row matches.
Throws DatabaseException if the entity table does not exist.
Implementation
Future<T?> get<T>(Object tableEntityInstance, String afterWhere) async {
final List<Map<String, Object?>> rows = await (await db).transaction(
(txn) => txn.rawQuery(
'SELECT * FROM ${T.toString()} WHERE ${_sanitizeWhere(afterWhere)}',
),
);
if (rows.isEmpty) return null;
return (tableEntityInstance as dynamic).fromMap(rows.first) as T;
}