forEachIndexed method
Iterates through the iterable with both index and element.
Example:
[1, 2].forEachIndexed((index, element) => print('$index: $element'));
Implementation
void forEachIndexed(void Function(int index, T element) f) {
var index = 0;
for (var element in this) {
f(index++, element);
}
}