Reputation: 744
So I'm trying to use kotlinx-coroutines-reactor
to try out the Flux pattern in my KMM project.
I've tried versions 1.6.4
and 1.6.3-native-mt
but can only use flows, for some reason Flux isn't available. I can't import it, and when I try and manually import it, it says unresolved reference.
It looks like the package is pure kotlin, so I'm not sure why it can't be imported. If I put the dependencies under androidMain
I can use it, but not under commonMain
where I'd like to keep things common.
I want to place it under common to have my list of side effects be shared between platforms.
Upvotes: 1
Views: 302
Reputation: 4139
Project reactor is not compatible with android or any other mobile platform, it is a java/jvm project.
Therefore, the compatibility layer provided between Project Reactor and Kotlin coroutines is also only available in Kotlin JVM based projects. If you take a look at the kotlinx-coroutine-reactor build file you will see that it only defines configuration for jvm target.
I have not very much experience with multiplatform mobile projects, but I'd say that Kotlin coroutine Flow API is the way to deal with datastream. Now, with a little search, maybe you can find a pure Kotlin multiplatform Rx Kotlin library to replace Reactor, if you really need to.
Upvotes: 1