fun doSomething(param: SomeParams): Single<Something>
where Single is from RxJava. I want to use coroutines inside my implementation and wrap the value at the end. But how can I create the CoroutineContext? It’s ok to use the runBlocking in this context? something like this:
Copy code
fun doSomething(param: SomeParams): Single<Something> = Single.just(
runBlocking {
doSomething()
}
)
suspend fun doSomething(): Something = TODO()
Thanks
m
mkrussel
11/12/2021, 1:26 PM
Using
Single.just()
is probably a mistake, that will do the
runBlocking
when
doSomething
is called instead of when someone subscribes to the
Single
. That defeats the entire goal of being reactive.
Also using