flatMapConcat

fun <T, R> Flow<T>.flatMapConcat(transform: suspend (T) -> Flow<R>): Flow<R>

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

This method is a shortcut for map(transform).flattenConcat(). See flattenConcat.

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.

Sources

common source
Link copied to clipboard