On this page
lastIndexOf method
int lastIndexOf(Returns the last index in the list a
of the given element
, starting the search at index startIndex
to 0. Returns -1 if element
is not found.
Source
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