//Extensions for Jetpack Lifecycle/it.czerwinski.android.lifecycle.livedata/defaultIfEmpty

defaultIfEmpty

[androidJvm]
Content
fun <T> LiveData<T>.defaultIfEmpty(defaultValue: T): LiveData<T>
More info

Returns a LiveData that emits the values emitted by this LiveData or a specified default value if this LiveData has not yet emitted any values at the time of observing.

[androidJvm]
Content
fun <T> LiveData<T>.defaultIfEmpty(defaultValueProducer: () -> T): LiveData<T>
More info

Returns a LiveData that emits the values emitted by this LiveData or a value returned by defaultValueProducer if this LiveData has not yet emitted any values at the time of observing.

defaultValueProducer will be executed on the main thread.