getSingle method

  1. @override
Future<Tile> getSingle()
inherited

Executes this statement, like get, but only returns one value. If the query returns no or too many rows, the returned future will complete with an error.

Be aware that this operation won't put a limit clause on this statement, if that's needed you would have to do use limit: You should only use this method if you know the query won't have more than one row, for instance because you used limit(1) or you know the filters you've applied will only match one row.

See also: getSingleOrNull, which returns null instead of throwing if the query completes with no rows.

Uses the distinct flag to ensure that only distinct rows are returned

Implementation

@override
Future<DT> getSingle() =>
    $state.copyWith(distinct: true).buildSelectStatement().getSingle();