stream<T> method

AsyncValue<T> stream<T>(
  1. Stream<T> stream
)

Consumes a Stream and watches the given stream.

If the given stream changes between build calls, then the current StreamSubscription will be disposed and recreated for the new stream. Thus, it is important that the stream instance only changes when needed. It is incorrect to create a stream in the same build as the stream, unless you use something like memo to limit changes. Or, if possible, it is even better to wrap the stream in an entirely new capsule (although this is not always possible).

Implementation

AsyncValue<T> stream<T>(Stream<T> stream) => use.nullableStream(stream)!;