lastIndexIn method

int lastIndexIn(
  1. String sequence, [
  2. int? start
])

Returns the first matching index in sequence, searching backward starting at start (inclusive). Returns -1 if it could not be found.

Implementation

int lastIndexIn(String sequence, [int? start]) {
  final index = start == null ? sequence.length : start + 1;
  final iterator = _runeIteratorAt(sequence, index);
  while (iterator.movePrevious()) {
    if (match(iterator.current)) {
      return iterator.rawIndex;
    }
  }
  return -1;
}