windowWhen<O> method

Observable<Stream<T>> windowWhen <O>(Stream<O> other)

Creates an Observable where each item is a Stream containing the items from the source sequence, sampled on onStream.

Example

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

Implementation

Observable<Stream<T>> windowWhen<O>(Stream<O> other) =>
    transform(new WindowStreamTransformer<T>(onStream(other)));