I\'m trying to use Coroutines with a Room database in an Android project. I\'ve found almost no documentation online, and I\'m wondering if it is possible to return De
Your issue lies in that you're mixing the suspend
ing converter and the Deferred
converter. Use one or the other and your code will work as intended.
fun readMyObjectAsync(idMyObject: Int): Deferred<MyObject>
- Best choice if you need to interface/be compatible with java code, since it doesn't require code transformations to actually function.suspend fun readMyObjectAsync(idMyObject: Int): MyObject
- If you're operating on pure kotlin this will allow better control through the context it is called in.