windowTime method

Stream<Stream<T>> windowTime(
  1. Duration duration
)

Creates a Stream where each item is a Stream containing the items from the source sequence, sampled on a time frame with duration.

Example

Stream.periodic(Duration(milliseconds: 100), (int i) => i)
  .windowTime(Duration(milliseconds: 220))
  .doOnData((_) => print('next window'))
  .flatMap((s) => s)
  .listen(print); // prints next window 0, 1, next window 2, 3, ...

Implementation

Stream<Stream<T>> windowTime(Duration duration) =>
    window(Stream<void>.periodic(duration));