hasNext property

Future<bool> hasNext

Whether the stream has any more events.

Returns a future that completes with true if the stream has any more events, whether data or error. If the stream closes without producing any more events, the returned future completes with false.

Can be used before using next to avoid getting an error in the future returned by next in the case where there are no more events. Another alternative is to use take(1) which returns either zero or one events.

Implementation

Future<bool> get hasNext {
  _checkNotClosed();
  var hasNextRequest = _HasNextRequest<T>();
  _addRequest(hasNextRequest);
  return hasNextRequest.future;
}