forEachIndexedWhile method Null safety
Takes an action for each element and index as long as desired.
Calls action
for each element along with the index in the
iteration order.
Stops iteration if action
returns false
.
Implementation
void forEachIndexedWhile(bool Function(int index, E element) action) {
for (var index = 0; index < length; index++) {
if (!action(index, this[index])) break;
}
}