MutableLiveData

class MutableLiveData<T>(instance: T) : LiveData<T>

A LiveData that can be mutated.

Constructors

Link copied to clipboard
constructor(instance: T)

Functions

Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard
open override 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
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.

open override fun observe(observer: Observer<T>): Observation
Link copied to clipboard
fun set(instance: T)

Sets the value of the LiveData and notifies all observers.

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