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

kevin.cianfarini

07/02/2019, 7:55 PM
Is anyone using
Flow
instead of
LiveData
? I'd like to use flow for everything but I don't know of any catches that Flow may have since I'm pretty inexperienced with it.
m

Matej Drobnič

07/02/2019, 8:02 PM
This is probably more #android topic, but I think that by using Flow you miss the biggest advantage of LiveData - Lifecycle awareness. When activity restarts after configuration change (for example after device rotation), LiveData automatically emits previous value without any computational overhead. Flow would resubscribe and need to recompute the value.
d

Dico

07/02/2019, 8:24 PM
You should be able to wrap
LiveData
in a
Flow
d

d.medina

07/22/2019, 12:39 AM
you can set the coroutine scope of the flow to the one provided by the lifecyle.
4 Views