indexOfFirst method
Returns index of the first element passing the given test
, or -1
if
the collection does not contain such element.
Implementation
int indexOfFirst(bool Function(E element) test) {
var index = 0;
for (final element in this) {
if (test(element)) return index;
index++;
}
return -1;
}