forEachIndexed method
Performs the given action on each element on iterable, providing sequential index with the element.
element!
the element on the current iteration
index!
the index of the current iteration
example:
"ss","tt","xx"
.forEachIndexed((it, index) {
print("it, $index");
});
result:
ss, 0
tt, 1
xx, 2
Implementation
void forEachIndexed(void action(T element, int index)) {
var index = 0;
for (var element in this!) {
action(element, index++);
}
}