rawIndex property

int get rawIndex

The starting position of the current rune in the string.

Returns -1 if there is no current rune (current is -1).

Implementation

int get rawIndex => (_position != _nextPosition) ? _position : -1;
set rawIndex (int rawIndex)

Resets the iterator to the rune at the specified index of the string.

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

Setting the position to the end of the string means that there is no current rune.

Implementation

void set rawIndex(int rawIndex) {
  IndexError.check(
    rawIndex,
    string.length,
    indexable: string,
    name: "rawIndex",
  );
  reset(rawIndex);
  moveNext();
}