Hi all, if you are using LiveData, these extension...
# android
h
Hi all, if you are using LiveData, these extensions can be useful
Copy code
val liveData: MutableLiveDataBoolean = MutableLiveData()
liveData
  .distinct()
  .filter { it == false }
  .map { true }
  .nonNull()
  .observe(lifecycleOwner, { result ->
    // result is non-null and always true
  })
Check it out: https://medium.com/@henrytao/chaining-livedata-like-rxjava-with-kotlin-extension-e3a2c15ac11
👍 3
g
nice job! What would be the final goal of such effort? To get rid of RxJava? I'm using both just to be in sync with android updates, but honestly, it's hard to justify LiveData presence when you already have Rx. The out of the box lyfecycle management is just a matter of one line from AutoDispose library or similar.