expandIndexed<R> method

Iterable<R> expandIndexed<R>(
  1. Iterable<R> expand(
    1. int index,
    2. E element
    )
)

Expands each element and index to a number of elements in a new iterable.

Like Iterable.expand except that the callback function is supplied with both the index and the element.

Implementation

Iterable<R> expandIndexed<R>(
    Iterable<R> Function(int index, E element) expand) sync* {
  for (var index = 0; index < length; index++) {
    yield* expand(index, this[index]);
  }
}