one method

Selection<R?> one({
  1. ToOneStrategy strategy = ToOneStrategy.automatic,
})

Selects at most one visible row, or null when no row matches.

A batch with multiple selected rows throws RELATION.CARDINALITY. When R is nullable, a present row containing SQL NULL also returns null; use required to require row presence independently of the selected value.

Implementation

Selection<R?> one({ToOneStrategy strategy = ToOneStrategy.automatic}) =>
    _useJoin(strategy)
    ? _JoinedRelationSelection<R?, F>(this)
    : _oneBatch().map((rows) => rows.firstOrNull);