Ad

How To Get Deffered From DAO?

- 1 answer

I want to get Kotlin Coroutnies Deffered from DAO

@Query("select * from gameprocess where cabinId = :cabinId ")
fun getAllGameProccesBiCabin(cabinId :Int) : Deferred<GameProcess>

but it does not compile (room does not know how to handle Deffered), but I need to use 'wait' from 'Deffered' how can do this?

as another option I could use extension function from this post but, dont know how to integrate it into dao:

https://codelabs.developers.google.com/codelabs/kotlin-coroutines/index.html?index=..%2F..index#6

Ad

Answer

here is dependency which allows me to use async{}.awaithttps://github.com/Kotlin/kotlinx.coroutines/blob/master/ui/coroutines-guide-ui.md

The problem was that I was using old version which doesn't support it.

Ad
source: stackoverflow.com
Ad