enumerate<T> function

void enumerate<T>(
  1. Iterable<T> iterable,
  2. void func(
    1. int,
    2. T
    )
)

Performs like forEach but invokes func with an enumeration.

Implementation

void enumerate<T>(Iterable<T> iterable, void Function(int, T) func) {
  int count = 0;
  for (final T value in iterable) {
    func(count, value);
    ++count;
  }
}