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
Since Room doesn't support MutableLiveData
and has support for LiveData
only, your approach of creating a wrapper is the best approach I can think of. It will be complicated for Google
to support MutableLiveData
since the setValue
and postValue
methods are public
. Where as for LiveData
they are protected
which gives more control.