Is there anyway/api to convert a Flow to LiveData?
# coroutines
t
Is there anyway/api to convert a Flow to LiveData?
g
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
sure, thank
h
I like the word «yet» in Andrey's reply ...
g
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
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