mapIndexed<R> method

Iterable<R> mapIndexed<R>(
  1. R transform(
    1. int index,
    2. E element
    )
)

Returns an Iterable containing the results of applying the given transform function to each element and its index in the original collection.

Implementation

Iterable<R> mapIndexed<R>(R Function(int index, E element) transform) =>
    withIndex.map(
      (indexedValue) => transform(indexedValue.index, indexedValue.value),
    );