watchSingleOrNull method
Creates an auto-updating stream of this statement, similar to
watch. However, it is assumed that the query will only
emit one result, so instead of returning a Stream<List<D>>
, this
returns a Stream<D?>
. If the query emits more than one row at
some point, an error will be emitted to the stream instead.
If the query emits zero rows at some point, null
will be added
to the stream instead.
The distinct
parameter (enabled by default) controls whether to generate
a SELECT DISTINCT
query, removing duplicates from the result.
Implementation
@override
Stream<$ActiveDataclass?> watchSingleOrNull({bool distinct = true}) =>
watch(distinct: distinct).transform(singleElementsOrNull());