hasNext property Null safety

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.


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