mapIndexed<R> method

Iterable<R> mapIndexed<R>(
  1. R convert(
    1. int index,
    2. T element
    )
)

Maps each element and its index to a new value.

Implementation

Iterable<R> mapIndexed<R>(R Function(int index, T element) convert) sync* {
  var index = 0;
  for (var element in this!) {
    yield convert(index++, element);
  }
}