I want the subject version of a flow (a flow I can...
# coroutines
z
I want the subject version of a flow (a flow I can force to emit). Does this exist yet? or do I need to back it with an external channel for now?
Copy code
private val channelA = Channel<Int>()
private val channelB = Channel<Int>()
private val flowA: Flow<Int> = channelA.consumeAsFlow()
private val flowB: Flow<Int> = channelB.consumeAsFlow()
suspend fun whenSourceAEmits(value: Int) {
    channelA.send(value)
}
suspend fun whenSourceBEmits(value: Int) {
    channelB.send(value)
}
o
yes, just back it with a (broadcast) channel instead, a la
scope.broadcast { ... }.asFlow()