mapFromRowOrNull method

D? mapFromRowOrNull(
  1. QueryRow row, {
  2. String? tablePrefix,
})

Like mapFromRow, but returns null if a non-nullable column of this table is null in row.

Implementation

D? mapFromRowOrNull(QueryRow row, {String? tablePrefix}) {
  final resolvedPrefix = tablePrefix == null ? '' : '$tablePrefix.';

  final notInRow = $columns
      .where((c) => !c.$nullable)
      .any((e) => row.data['$resolvedPrefix${e.$name}'] == null);

  if (notInRow) return null;

  return mapFromRow(row, tablePrefix: tablePrefix);
}