watchSingleOrNull method

  1. @override
Stream<Tile?> watchSingleOrNull()
inherited

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.

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

Implementation

@override
Stream<DT?> watchSingleOrNull() => $state
    .copyWith(distinct: true)
    .buildSelectStatement()
    .watchSingleOrNull();