window method

Stream<Stream<T>> window(
  1. Stream<void> window
)

Creates a Stream where each item is a Stream containing the items from the source sequence.

This List is emitted every time window emits an event.

Example

Stream.periodic(Duration(milliseconds: 100), (i) => i)
  .window(Stream.periodic(Duration(milliseconds: 160), (i) => i))
  .asyncMap((stream) => stream.toList())
  .listen(print); // prints [0, 1] [2, 3] [4, 5] ...

Implementation

Stream<Stream<T>> window(Stream<void> window) =>
    WindowStreamTransformer<T>((_) => window).bind(this);