What is the difference between using Coroutine and...
# announcements
m
What is the difference between using Coroutine and KotlinRx? or we could use them both?
g
What is KotlinRx?
m
g
It's RxKotlin
RxKotlin just a collection of extension function that adds some Kotlin goodies on top of RxJava, it's not reactive framework itself
So your question about RxJava and Coroutines?
You can use them both together, there is even kotlinx.coroutines adapter library for RxJava types Should or not you use them together depends on many factors (do you have any of them in your project is the biggest one) Difference of course in implementation and syntax. I would say that work with Coroutines suspend functions is much better than with RxJava Single/Completable/Maybe. In case of streams of.events Coroutines provide own abstraction for that: Flow, it's not so mature as RxJava Observable/Flowable and operators set is not complete, but solves the same set of problems and has own advantages because it based on suspend functions
m
Thanks @gildor for correcting and clarifying this🙏
g
Also, just our own example. In our new project we use kotlinx.coroutines for everything, suspend functions, Flow, Channels But for our main project we migrating from Single/Completable to suspend functions, but we still have both. Also for now we do not plan migrate to Flow because RxJava works fine and it’s very easy to use it together with coroutines,