I am using Room and implemented Dao that returns LiveData. It was working fine with below dependency added.
im
As Michael Vescovo pointed out, there are two possible ways of achieving async call:
@Dao
interface AccountDao{
@Query("SELECT * FROM account_master")
suspend fun getAllAccounts(): List
}
@Dao
interface AccountDao{
@Query("SELECT * FROM account_master")
fun getAllAccounts(): LiveData>
}
Which one you'll use depends on your use case. For example, I would use the first one if my DAO consumer (usually repository) will create LiveData for the model (in the case that I don't need to observe changes from local DB).
If I need to observe changes in local DB (for example, some other service can update DB in the meantime) I would use the second one.