all method

Future<List<DVRecord>> all({
  1. bool withDeleted = false,
})

Every record, excluding soft-deleted ones unless withDeleted.

Implementation

Future<List<DVRecord>> all({bool withDeleted = false}) async {
  final List<String> where = <String>[
    if (scope != null) '${scope!.column} = ?',
    if (!withDeleted && softDelete) '$deletedColumn IS NULL',
  ];
  final List<Map<String, Object?>> rows = await database.query(
    where.isEmpty
        ? 'SELECT * FROM $table'
        : 'SELECT * FROM $table WHERE ${where.join(' AND ')}',
    _scopeParams,
  );
  return <DVRecord>[
    for (final Map<String, Object?> row in rows)
      if (withDeleted || _fromRow(row).deletedAt == null) _fromRow(row),
  ];
}