getAllSorted<T> method

Future<List<T>?> getAllSorted<T>(
  1. Object tableEntityInstance,
  2. String afterWhere, [
  3. List<Object?>? whereArgs
])

Returns every object of type T matching afterWhere, or null when no row matches. Sort by putting ORDER BY at the end of afterWhere; ? placeholders take their values from whereArgs.

Throws DatabaseException if the entity table does not exist.

Implementation

Future<List<T>?> getAllSorted<T>(
  Object tableEntityInstance,
  String afterWhere, [
  List<Object?>? whereArgs,
]) async {
  final List<Map<String, Object?>> rows = await _selectWhere(
    '*',
    quoteIdentifier(_tableFor<T>()),
    afterWhere,
    whereArgs,
  );
  if (rows.isEmpty) return null;
  return _entities<T>(tableEntityInstance, rows);
}