firstOrNull method
Returns the first selected row, or null when the query is empty.
Fetches at most one root row. A nullable selection also returns null for a row containing SQL NULL; select a Record to distinguish these cases.
Implementation
Future<R?> firstOrNull({
ExecutionOptions options = const ExecutionOptions(),
}) async {
final rows = await take(queryState.limit == 0 ? 0 : 1)
.get(options: options);
return rows.isEmpty ? null : rows.first;
}