how to initialize livedata kotlin
snippet in kotlin

how to initialize livedata kotlin

user2896

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

val liveData = MutableLiveData<String>().default("Initial value!")