# moveNext method

bool moveNext ()

Moves to the next element.

Returns true if current contains the next element. Returns false if no elements are left.

It is safe to invoke moveNext even when the iterator is already positioned after the last element. In this case moveNext returns false again and has no effect.

A call to `moveNext` may throw if iteration has been broken by changing the underlying collection.

## Implementation

    bool moveNext() {
      _position = _nextPosition;
      if (_position == string.length) {
        _currentCodePoint = null;
        return false;
      }
      int codeUnit = string.codeUnitAt(_position);
      int nextPosition = _position + 1;
      if (_isLeadSurrogate(codeUnit) && nextPosition < string.length) {
        int nextCodeUnit = string.codeUnitAt(nextPosition);
        if (_isTrailSurrogate(nextCodeUnit)) {
          _nextPosition = nextPosition + 1;
          _currentCodePoint = _combineSurrogatePair(codeUnit, nextCodeUnit);
          return true;
        }
      }
      _nextPosition = nextPosition;
      _currentCodePoint = codeUnit;
      return true;
    }