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

Tuan Kiet

08/14/2019, 7:45 AM
Is there anyway/api to convert a Flow to LiveData?
g

gildor

08/14/2019, 7:46 AM
no official adapter yet, please check history of this channel, it discussed already a few times with some samples how you can implement it easily yourself
t

Tuan Kiet

08/14/2019, 7:47 AM
sure, thank
h

hallvard

08/14/2019, 8:01 AM
I like the word «yet» in Andrey's reply ...
g

gildor

08/14/2019, 9:10 AM
Because probably make sense to report an issue about it to Android issue tracker, they already have liveData builder with coroutines support, so I believe eventually it will be available as part of livedata-ktx, but would be nice to have an issue to track it
i

Icaro Temponi

08/14/2019, 11:37 AM
Looking at AOSP, there's an already merged pr with these converters, so it should be available on the next version of the lifecycle library. You can also look at the implementation and add to your project to use in the meantime. https://android-review.googlesource.com/c/platform/frameworks/support/+/1098315/2/lifecycle/lifecycle-livedata-ktx/src/main/java/androidx/lifecycle/FlowLiveData.kt
👍 2
2 Views