gmaciel
09/25/2019, 8:28 AMkotlinx.coroutines.rx2
? I'm wondering if i use rxSingle
, do i really need a context?
* Creates cold [single][Single] that will run a given [block] in a coroutine.
* Every time the returned observable is subscribed, it starts a new coroutine.
* Coroutine returns a single value. Unsubscribing cancels running coroutine.
Feels like as long i subscribes and unsubscribe in the right times it takes care of the coroutine and it doesn't cause memory leaks. Like this:
private fun single() = rxSingle {
suspendedFun()
}
Is this correct to assume? I also can't provide a Context with a job to cancel it anyways.gildor
09/25/2019, 8:34 AMgmaciel
09/25/2019, 8:55 AM