https://kotlinlang.org logo
Title
r

ritesh

08/03/2022, 4:03 AM
Should you be collecting
SharedFlow/PublishSubject
in composable? When we talk about uni-directional data flow, aren't we deviating from it when we start collecting the
Shared/Publish
in an effect-handler or uni-directional flow just talks about events flowing from composable - up in the tree.
l

Landry Norris

08/03/2022, 2:01 PM
I generally collect from a StateFlow (type of SharedFlow), but I don’t collect from a MutableStateFlow, which keeps unidirectional data flow. I call functions on my ComponentContext (from #decompose) to send events, and my SharedFlow sends state back down.