lastIndexOf method
Returns the index of the last occurrence of the specified byte.
value
the byte to search for
start
the starting index from the end (optional)
Returns -1 if not found
Implementation
int lastIndexOf(int value, [int? start]) {
int startIndex = start ?? _bytes.length - 1;
for (int i = startIndex; i >= 0; i--) {
if (_bytes[i] == value) return i;
}
return -1;
}