MVVM - MutableLiveData of Custom Model not been updating into ViewModel with databinding and always is null
Summary:
When I try to send to the repository a custom Model, the MutableLiveData is null. I think it is because of the observer of the MutableLiveData.
Please, read to the end.
ViewModel
class LoginViewModel @Inject constructor(
private val repository: MyRepository) : ViewModel() {
var loginModel: MutableLiveData
init {
loginModel = MutableLiveData()
}
fun loadUser(): LiveData {
return repository.login(loginModel.value!!)
}
}
As you can...