take method
Requests the next count data events as a list.
The count must be non-negative.
Equivalent to calling next count times and
storing the data values in a list.
If an error occurs before count data events has
been collected, the returned future completes with
that error instead.
If the stream closes before count data events,
the returned future completes with the list
of data collected so far. That is, the returned
list may have fewer than count elements.
Implementation
Future<List<T>> take(int count) {
RangeError.checkNotNegative(count, 'count');
_checkNotClosed();
var request = _TakeRequest<T>(count);
_addRequest(request);
return request.future;
}