Skip to content

Instantly share code, notes, and snippets.

@prokash-sarkar
Created September 28, 2019 04:39
Show Gist options
  • Save prokash-sarkar/bb80dfd8d2da97ea999601399e72344c to your computer and use it in GitHub Desktop.
Save prokash-sarkar/bb80dfd8d2da97ea999601399e72344c to your computer and use it in GitHub Desktop.
Using LiveDataReactiveStreams to convert Flowable
fun <T> LiveData<T>.toFlowable(owner: LifecycleOwner): Flowable<T> =
Flowable.fromPublisher(LiveDataReactiveStreams.toPublisher(owner, this))
fun <T> Flowable<T>.toLiveData(): LiveData<T> = LiveDataReactiveStreams.fromPublisher(this)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment