whereIndexed method
Returns all elements that satisfy the given predicate
.
Implementation
Iterable<E> whereIndexed(
bool Function(E element, int index) predicate,
) sync* {
var index = 0;
for (final element in this) {
if (predicate(element, index++)) {
yield element;
}
}
}