https://kotlinlang.org logo
#coroutines
Title
# coroutines
n

Nemanja Mladenović

11/20/2020, 5:15 PM
Can someone explain how to convert live data to state flow in this situation: - livedata2 is map of another livedata1 in vm and there are 2 observers in ui layer, one observes original livedata1, and other observes mapped livedata2 What I discovered is that simply converting live data to state flow is not working as expected. Map is converting state flow to flow and not state flow. Second I cannot get both flows to trigger collect when collect are written as part of the same scope in ui layer. Any resource on the subject?
First image view model Second fragment code that works Third fragment code that doesn't work
8 Views