flatMap

fun <E, R> ReceiveChannel<E>.flatMap(
    context: CoroutineContext = Unconfined,
    transform: suspend (E) -> ReceiveChannel<R>
): ReceiveChannel<R>
(source)

Platform and version requirements: JVM

Returns a single channel of all elements from results of transform function being invoked on each element of original channel.

The operation is intermediate and stateless. This function consumes all elements of the original ReceiveChannel.