Answers for "how to initialize a livedata when declaring kotlin"

1

how to initialize livedata kotlin

fun <T : Any?> MutableLiveData<T>.default(initialValue: T) = apply { setValue(initialValue) }

val liveData = MutableLiveData<String>().default("Initial value!")
Posted by: Guest on November-21-2020

Code answers related to "how to initialize a livedata when declaring kotlin"

Browse Popular Code Answers by Language