maxmello
09/13/2021, 2:20 PMcallbackFlow + stateIn or a flow created with combine + stateIn . Now this is a StateFlow which has no emit that is callable from “outside”. Is there a way to achieve this, basically a .toMutableStateFlow() ?Tijl
09/13/2021, 2:22 PMMutableStateFlow you can do myStateFlow.collect(someOtherFlow)maxmello
09/13/2021, 2:49 PMimmutableStateFlow.collect { newValue -> mutableStateFlow.update { newValue } } , I assume this is what you mean? A function to directly pass in another flow is marked as @InternalCoroutinesApi for meTijl
09/13/2021, 2:53 PMMutableStateFlow that you want to emit to, and then make it collect the flow (e.g. the callbackFlow you mentioned). then you can do what you want, rely on values from the upstream flow, or emit directly.
if you don’t want to do this because of the InternalCoroutinesApi then I would suggest finding another solutionTijl
09/13/2021, 2:54 PMupstreamFlow.collect(myStateFlow) of course