moveNext method

  1. @override
bool moveNext()
override

Moves the iterator to the next element.

Must be called before accessing the first element. If this method returns true it is safe to access the current element.

Concurrent modification is not checked before advancing the iterator. UncheckedStrideIterator should be used for iterating fixed length iterables.

Implementation

@override
bool moveNext() {
  _position += stepSize;
  if (_position < _length) {
    _current = _iterable.elementAt(_position);
    return true;
  } else {
    _current = null;
    _position = _length;
    return false;
  }
}