klayground
klayground copied to clipboard
Question about the flatMapMerge() operator
Hello Garima,
Your repo is a great example of using Kotlin Flows with the MVI architecture, so thanks for it 😃. I have a quick question though. In processActions ()
method of your CharactersViewModel
. You demonstrated two approaches of mapping from actions to results. When using the streaming approach in actionToResultTransformer()
, I noticed that my actionsFlow suddenly returns emits more than one action which in turn executes more than one network call. So flowOf("A") emits "A", "A" or sometimes "A","A","A" when I pass it into actionToResultTransformer()
but behaves normally when I use the non streaming approach. Is there a reason for this behaviour and how can it be fixed?