LiveData

abstract class LiveData<out T>

A lifecycle-aware observable that sends only new updates after subscription.

Inheritors

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

Flattens a LiveData of LiveData into a LiveData of the inner type.

Link copied to clipboard
abstract fun getValue(): T

Returns the current value with no observation.

Link copied to clipboard
fun <S, T> LiveData<T>.map(transformT: (T) -> S): LiveData<S>

Maps the value of the LiveData to a new value using the provided transformation function.

Link copied to clipboard
abstract fun observe(observer: Observer<T>): Observation

fun observe(lifecycleOwner: LifecycleOwner, closure: (T) -> Unit): ObservationWeakReference

Observe the data for as long as the given lifecycleOwner is in memory or until the returned observation is cancelled.

Link copied to clipboard
infix fun <S, T> LiveData<S>.zipWith(liveData: LiveData<T>): LiveData<Pair<S, T>>