@FlowPreview fun <T, R> Flow<T>.flatMapMerge((source)
concurrency: Int = DEFAULT_CONCURRENCY,
transform: suspend (value: T) -> Flow<R>
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 merges the resulting flows with a concurrency
limit on the number of concurrently collected flows.
It is a shortcut for
See flattenMerge for details.
Note that even though this operator looks very familiar, we discourage its usage in a regular application-specific flows. Most likely, suspending operation in map operator will be sufficient and linear transformations are much easier to reason about.
Applications of flowOn, buffer, produceIn, and broadcastIn after this operator are fused with its concurrent merging so that only one properly configured channel is used for execution of merging logic.