mapIndexed<V> method

Iterable<V> mapIndexed<V>(
  1. V mapper(
    1. int,
    2. T
    )
)

Maps an Iterable (like map), but you have access to both the element and the index on the mapping function.

Implementation

Iterable<V> mapIndexed<V>(V Function(int, T) mapper) {
  var i = 0;
  return map((item) => mapper(i++, item));
}