next property
Requests the next (yet unrequested) event from the stream.
When the requested event arrives, the returned future is completed with the event. If the event is a data event, the returned future completes with its value. If the event is an error event, the returned future completes with its error and stack trace. If the stream closes before an event arrives, the returned future completes with a StateError.
It's possible to have several pending next calls (or other requests), and they will be completed in the order they were requested, by the first events that were not consumed by previous requeusts.
Implementation
Future<T> get next {
_checkNotClosed();
var nextRequest = _NextRequest<T>();
_addRequest(nextRequest);
return nextRequest.future;
}