Hello. I'm trying to use com.shopify.livedataktx.MutableLiveDataKtx to avoid the invasion of nullables and !! in kotlin code using ViewModel. How do you make a two-way binding with that kind of MutableLiveDataKtx?
r
rkeazor
11/26/2019, 1:45 AM
probably the same way you use liveData
But its only nullable,because of platform type, dont see the big deal really
m
melatonina
11/26/2019, 8:34 AM
@rkeazor it is a big deal: it introduces null everywhere.
I have no idea of how to debug that. Do you see where the problem is?
r
rkeazor
11/26/2019, 12:04 PM
Isnt MutableLiveDataKtx a child of LiveData
You shouldnt have to do that
Just when you bind it remember to bind the lifecycle owner as well
There is something werid about your inverse binding adapter. But before you do that ,Make MutableLivrDataKtx extend mutableLiveData. Not livedata. It should work out the box with 2 way data binding
m
melatonina
11/26/2019, 1:00 PM
I'll look into that. I didn't write MutableLiveDataKtx. No idea why they subclassed LiveData
MutableLiveDataKtx subclassed LiveDataKtx and makes the mutating methods public, just like MutableLiveData does with LiveData.
r
rkeazor
11/26/2019, 1:15 PM
Does LiveDataKtx subclass livedata
I say just use MutableLiveData
It's not as big of deal as you think it is lol. The wrapper, isnt anything special