flatMapConcatEager

fun <T, R> Flow<T>.flatMapConcatEager(concurrency: Int = DEFAULT_CONCURRENCY, bufferSize: Int = Channel.BUFFERED, transform: suspend (value: T) -> Flow<R>): Flow<R>(source)

Transforms elements emitted by the original flow by applying transform, that returns another flow, and then merging and flattening these flows.

This operator calls transform sequentially and then concatenates the resulting flows with a concurrency limit on the number of concurrently collected flows. It is a shortcut for map(transform).flattenConcatEager(concurrency). See flattenConcatEager for details.

Operator fusion

Applications of flowOn, buffer, and produceIn after this operator are fused with its concurrent merging so that only one properly configured channel is used for execution of merging logic.

Parameters

concurrency

controls the number of in-flight flows, at most concurrency flows are collected at the same time. By default, it is equal to DEFAULT_CONCURRENCY.

bufferSize

hints about the number of expected values from each inner Flow. Should be either a positive channel capacity or one of the constants defined in Channel. If inner Flow tries to emit more than bufferSize values before being concatenated to output, then it will be suspended