read method

Future<DVRecord?> read(
  1. Object id, {
  2. bool withDeleted = false,
})

The record with id, or null. A soft-deleted record is null unless withDeleted.

Implementation

Future<DVRecord?> read(Object id, {bool withDeleted = false}) async {
  final List<Map<String, Object?>> rows = await database.query(
    'SELECT * FROM $table WHERE $key = ?$_scopeAnd',
    <Object?>[id, ..._scopeParams],
  );
  if (rows.isEmpty) return null;
  final DVRecord record = _fromRow(rows.first);
  if (!withDeleted && record.deletedAt != null) return null;
  return record;
}