forEachIndexed method

void forEachIndexed(
  1. dynamic f(
    1. int,
    2. T
    )
)

Same as Iterable.foreach except that the f function also receives the index of the item

Implementation

void forEachIndexed(Function(int, T) f) {
  var index = 0;
  return forEach((element) => f(index++, element));
}