iex
02/11/2020, 3:51 PMLiveData
with a fixed value (like `Observable`'s just
), without having to use MutableLiveData
?kioba
02/11/2020, 4:06 PMLiveData
works but based on the docs LiveData has a default value constructor.
https://developer.android.com/reference/androidx/lifecycle/LiveData.html#LiveData(T)
Is that what you are looking for?iex
02/11/2020, 5:42 PMLiveData
is an abstract class @kiobakioba
02/11/2020, 6:39 PMMaciek
02/12/2020, 7:04 AMfun <T> LiveData(initValue: T): LiveData<T> = MutableLiveData<T>().apply { value = initValue }
iex
02/12/2020, 9:57 AMMaciek
02/12/2020, 10:02 AMpublic inline fun <T> List(size: Int, init: (index: Int) -> T): List<T> = MutableList(size, init)