Метод lastIndexOf
int lastIndexOf(Возвращает последний индекс в списке a данного element, начиная поиск с индекса startIndex до 0. Возвращает -1, если element не найден.
Исходный код
int lastIndexOf(Object element, [int startIndex]) {
if (startIndex == null) {
startIndex = this.length - 1;
} else {
if (startIndex < 0) {
return -1;
}
if (startIndex >= this.length) {
startIndex = this.length - 1;
}
}
for (int i = startIndex; i >= 0; i--) {
if (this[i] == element) {
return i;
}
}
return -1;
}
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-collection/ListMixin/lastIndexOf.html