watch method

Stream<List<R>> watch({
  1. Iterable<TableSchema> reads = const [],
  2. ExecutionOptions options = const ExecutionOptions(),
})

Initial snapshot followed by fresh snapshots after relevant committed writes. Add tables hidden inside raw SQL with reads. Read errors are emitted without closing the stream, allowing a later invalidation to retry the query.

Watches require a root database outside leased sessions and transactions. ORM writes report their physical tables automatically; raw or external writes require explicit invalidation. Cancelling the subscription releases its listener, and closing the database stops its watches.

Implementation

Stream<List<R>> watch({
  Iterable<TableSchema> reads = const [],
  ExecutionOptions options = const ExecutionOptions(),
}) => _QueryWatch(this, List.unmodifiable(reads), options).controller.stream;