bool movePrevious()

Move back to the previous element.

Returns true and updates current if successful. Returns false and sets current to null if there is no previous element.

Source

bool movePrevious() {
  _nextPosition = _position;
  if (_position == 0) {
    _currentCodePoint = null;
    return false;
  }
  int position = _position - 1;
  int codeUnit = string.codeUnitAt(position);
  if (_isTrailSurrogate(codeUnit) && position > 0) {
    int prevCodeUnit = string.codeUnitAt(position - 1);
    if (_isLeadSurrogate(prevCodeUnit)) {
      _position = position - 1;
      _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit);
      return true;
    }
  }
  _position = position;
  _currentCodePoint = codeUnit;
  return true;
}