next method

E next()

Provides the next element of the iterable, and moves past it.

Must only be used when hasNext is true. The value of hasNext can change after calling this method.

Implementation

E next() {
  if (_ensureHasNext) {
    _hasNext = null;
    return _iterator.current;
  }
  throw StateError("No more elements");
}