reset method Null safety

void reset(
  1. [int rawIndex = 0]
)

Resets the iterator to the given index into the string.

After this the current value is unset. You must call moveNext make the rune at the position current, or movePrevious for the last rune before the position.

The rawIndex must be non-negative and no greater than string.length. It must also not be the index of the trailing surrogate of a surrogate pair.

Implementation

void reset([int rawIndex = 0]) {
  RangeError.checkValueInInterval(rawIndex, 0, string.length, "rawIndex");
  _checkSplitSurrogate(rawIndex);
  _position = _nextPosition = rawIndex;
  _currentCodePoint = -1;
}