Colton Idle
07/27/2024, 5:59 PMshareIn
operator on it to get a hot flot but you need to provide a scope. Why can you have a SharedFlow with no scope, and a coldFlow.shareIn() requires a scope?Francesc
07/27/2024, 6:11 PMColton Idle
07/27/2024, 6:28 PMFrancesc
07/27/2024, 6:30 PMval foo = MutableSharedFlow(/* ... */)
?Francesc
07/27/2024, 6:33 PMJoffrey
07/27/2024, 6:34 PMephemient
07/27/2024, 7:03 PMflow.shareIn(scope)
≈ MutableSharedFlow().apply { scope.launch { flow.collect { emit(it) } } }
that's one coroutine dedicated to collecting the original flow and emitting items to the shared flow. but if you create your own mutable shared flow, you can emit to it from anywhere. the flow isn't scoped, the collector is