forEachIndexed method

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

For each method with provides not only the element but the index as well.

See forEach.

Implementation

void forEachIndexed(void Function(int index, T element) f) {
  if (isNullOrEmpty) return;
  for (var i = 0; i < this!.length; i++) {
    f(i, this![i]);
  }
}