bufferWhen<O> method

Observable<List<T>> bufferWhen <O>(Stream<O> other)

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

Example

new Observable.periodic(const Duration(milliseconds: 100), (int i) => i)
  .bufferWhen(new Stream.periodic(const Duration(milliseconds: 220), (int i) => i))
  .listen(print); // prints [0, 1] [2, 3] [4, 5] ...

Implementation

Observable<List<T>> bufferWhen<O>(Stream<O> other) =>
    transform(new BufferStreamTransformer<T>(onStream(other)));