forEachIndexed method

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

Gives possibility to use index in forEach function

Implementation

forEachIndexed(void Function(int index, T item) f) {
  var i = 0;
  forEach((e) => f(i++, e));
}