broadcastIn

@FlowPreview fun <T> Flow<T>.broadcastIn(
    scope: CoroutineScope,
    start: CoroutineStart = CoroutineStart.LAZY
): BroadcastChannel<T>
(source)

Creates a broadcast coroutine that collects the given flow.

This transformation is stateful, it launches a broadcast coroutine that collects the given flow and thus resulting channel should be properly closed or cancelled.

A channel with default buffer size is created. Use buffer operator on the flow before calling produce to specify a value other than default and to control what happens when data is produced faster than it is consumed, that is to control backpressure behavior.