buffer method

Observable<List<T>> buffer (Stream window)

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

This List is emitted every time window emits an event.

Example

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

Implementation

Observable<List<T>> buffer(Stream window) =>
    transform(BufferStreamTransformer((_) => window));