reset method

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.

Setting a negative rawIndex, or one greater than string.length, is an error. So is setting it in the middle of a surrogate pair.

Implementation

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