forEachIndexed method

void forEachIndexed(
  1. void action(
    1. E element,
    2. int index
    )
)

Performs the given action on each element, providing sequential index with the element.

Implementation

void forEachIndexed(void Function(E element, int index) action) {
  var index = 0;
  for (var element in this) {
    action(element, index++);
  }
}