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 codeUnits = sequence.codeUnits;
  start ??= codeUnits.length - 1;
  for (var i = start; i >= 0; i--) {
    if (match(codeUnits[i])) {
      return i;
    }
  }
  return -1;
}