mapIndexed<R, T> function Null safety

Iterable<R> mapIndexed<R, T>(
  1. Iterable<T> input,
  2. R mapper(
    1. T item,
    2. int index
    )
)

Implementation

Iterable<R> mapIndexed<R, T>(Iterable<T> input, R mapper(T item, int index)) {
  int i = 0;
  return input.map((item) => mapper(item, i++));
}