flatMapIndexed<R> method

KtList<R> flatMapIndexed<R>(
  1. KtIterable<R> transform(
    1. int index,
    2. T
    )
)

Returns a single list of all elements yielded from results of transform function being invoked on each element and its index in the original collection.

Implementation

KtList<R> flatMapIndexed<R>(KtIterable<R> Function(int index, T) transform) {
  final list = flatMapIndexedTo(mutableListOf<R>(), transform);
  // making a temp variable here, it helps dart to get types right ¯\_(ツ)_/¯
  // TODO ping dort-lang/sdk team to check that bug
  return list;
}