buffer method
Creates a Stream where each item is a List 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)
.buffer(Stream.periodic(Duration(milliseconds: 160), (i) => i))
.listen(print); // prints [0, 1] [2, 3] [4, 5] ...
Implementation
Stream<List<T>> buffer(Stream<void> window) =>
BufferStreamTransformer<T>((_) => window).bind(this);