The error from the title is returned for the following code, which makes no sense
private val _error = MutableLiveData<String?>()
val error: LiveData<String?> get() = _error
_error.postValue(null) //Error Cannot set non-nullable LiveData value to null [NullSafeMutableLiveData]
parameter String of _error is obviously nullable, am I doing something wrong?
This appears to be related to a bug already reported against
androidx.lifecyclepre-release of 2.3.0 https://issuetracker.google.com/issues/169249668.Workarounds I have found:
NullSafeMutableLiveDatainbuild.gradleor
lint.xmlin root dirMutableLiveDataencapsulation via backing properties dance (which really hurts my eyes).