Jon
07/20/2021, 7:24 PMfun getLiveData(): LiveData<Result?> { return mResult }
where mResult is just a simple POJO. I am confused a bit about how kotlin interprets the return type for this function. I would imagine this to be non-null but when I try to call it, it forces me to use the null-safe operator "?.". If I wanted this to be nullable, I would imagine the return type would be
LiveData<Result?>?
with the appended "?"Christiano
07/20/2021, 8:07 PMJon
07/20/2021, 8:25 PMJon
07/20/2021, 8:28 PMmResult
in my example is always initialized to MutableLiveData()
when my app starts. It is never set to null. However, I am getting reports of crashes that indicate getLiveData()
is actually returning null.Zun
07/21/2021, 7:49 AM