WindowCountStreamTransformer<T> constructor
Constructs a StreamTransformer which buffers events into a Stream and
emits this Stream whenever its length is equal to count
.
A new buffer is created for every n-th event emitted
by the Stream that is being transformed, as specified by
the startBufferEvery
parameter.
If startBufferEvery
is omitted or equals 0, then a new buffer is started whenever
the previous one reaches a length of count
.
Implementation
WindowCountStreamTransformer(int count, [int startBufferEvery = 0])
: super(WindowStrategy.onHandler, null,
onWindowEnd: (queue) => Stream.fromIterable(queue),
startBufferEvery: startBufferEvery,
closeWindowWhen: (queue) => queue.length == count) {
if (count < 1) throw ArgumentError.value(count, 'count');
if (startBufferEvery < 0) {
throw ArgumentError.value(startBufferEvery, 'startBufferEvery');
}
}