-
Notifications
You must be signed in to change notification settings - Fork 5
LiveDataExtensions
BirjuVachhani edited this page Feb 1, 2019
·
4 revisions
liveData.watch {
// All you do in your code is observe
}
liveData.immutable() // converts a MutableLiveData to LiveData
// Throws an exception if it is not convertible
val liveData = MutableLiveData<String>().initWith("Default_text")
userListLiveData.value?.add(User("Birju"))
userListLiveData.notify()
Helpful when you're not changing the value of it but just updating some values in it. e.g. adding an item into list.
For more information, look at the LiveDataExtensions.kt file.
Here are the available Class Extensions: