watch method

  1. @override
Stream<List<D>> watch()
override

Creates an auto-updating stream of the result that emits new items whenever any table used in this statement changes.

Implementation

@override
Stream<List<D>> watch() {
  final query = constructQuery();
  final fetcher = QueryStreamFetcher(
    readsFrom: TableUpdateQuery.onAllTables(query.watchedTables),
    fetchData: () => _getRaw(query),
    key: StreamKey(query.sql, query.boundVariables),
  );

  return database.createStream(fetcher).asyncMapPerSubscription(_mapResponse);
}