mapWithIndex<E> method

Iterable<E> mapWithIndex<E>(
  1. E f(
    1. int index,
    2. T value
    )
)

Returns a new lazy Iterable with elements and its index.

Implementation

Iterable<E> mapWithIndex<E>(E Function(int index, T value) f) =>
    Iterable.generate(length).map((e) => f(e, elementAt(e)));