LiveData<T> class abstract

Observable state holder that allows for imperatively setting and reading the state value

You'd use this inside a ViewModel to expose state for the UI to observe/listen like this

class CounterViewModel extends ViewModel {
  final MutableLiveData<int> _counter = MutableLiveData(0);

  LiveData<int> get counter => _counter;

  void increment() {
    _counter.value++;
  }
}

@see also LiveDataBuilder and LiveDataListener

Implementers

Constructors

LiveData(T _currentValue)

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
observe(LiveDataObserver<T> observer) → void
removeObserver(LiveDataObserver<T> observer) → void
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited