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