Is their a need to wrap a DAO Room coroutine funct...
# room
r
Is their a need to wrap a DAO Room coroutine function with a withcontext(Dispatcher.io) block. Example
Query()
suspend fun getUser():User
Repository
suspend fun getUserFromDb():User {
return withcontext (<http://dispatcher.IO|dispatcher.IO>) {return data.getUser()}
}
Thread in Slack Conversation
🚫 1
k
https://medium.com/androiddevelopers/room-coroutines-422b786dc4c5
The generated code ensures that the insert happens off of the UI thread.
Room suspend functions are main safe
r
Thanks👍