https://kotlinlang.org logo
Title
m

Mauricio Barbosa

05/13/2020, 8:36 PM
Hi guys, I'm trying to convert an rxjava api based into a suspend function. Can I do something like this?
class UserApiClient(private val rxJavaBasedApi) {
    suspend fun getUser(): User = withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
        rxJavaBasedApi.getUser().blockingGet()
    }
}
Or there's a better approach?
o

octylFractal

05/13/2020, 8:37 PM
m

Mauricio Barbosa

05/13/2020, 8:46 PM
hm... I didn't know about this lib. I'll try this. Thank's @octylFractal