getAll<T> method

Future<List<T>?> getAll<T>(
  1. Object tableEntityInstance
)

Returns every object of type T currently stored, or null when the table is empty.

Throws DatabaseException if the entity table does not exist.

Implementation

Future<List<T>?> getAll<T>(Object tableEntityInstance) async {
  final List<Map<String, Object?>> rows =
      await (await db).transaction((txn) => txn.query(T.toString()));
  if (rows.isEmpty) return null;
  return rows
      .map((Map<String, Object?> row) =>
          (tableEntityInstance as dynamic).fromMap(row) as T)
      .toList();
}