broadcastIn

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

Deprecated

This API is deprecated. The BroadcastChannel provides a complex channel-like API for hot flows. SharedFlow is a easier-to-use and more flow-centric API for the same purposes, so using shareIn operator is preferred. It is not a direct replacement, so please study shareIn documentation to see what kind of shared flow fits your use-case. As a rule of thumb:

  • Replace broadcastIn(scope) and broadcastIn(scope, CoroutineStart.LAZY) with shareIn(scope, 0, SharingStarted.Lazily).

  • Replace broadcastIn(scope, CoroutineStart.DEFAULT) with shareIn(scope, 0, SharingStarted.Eagerly).

Sources

common source
Link copied to clipboard