Apparently, Room is not able to handle MutableLiveData and we have to stick to LiveData as it returns the following error:
error: Not sure how to convert a Curso
If you really need to, then you can use the mediator trick.
In your ViewModel
val sourceProduct: LiveData() = repository.productFromDao()
val product = MutableLiveData()
val mediator = MediatorLiveData()
init {
mediator.addSource(sourceProduct, { product.value = it })
}
In fragment/activity
observe(mediator, {})
observe(product, { //handle product })