LiveData<T> class

可以观测的数据,同时可以感知生命周期

Constructors

LiveData(T data)

Properties

activeCount ↔ int
getter/setter pair
changingActiveState ↔ bool
getter/setter pair
dispatchInvalidated ↔ bool
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
observers ↔ Map<Observer<T>, ObserverWrapper<T>>
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
valueDispatching ↔ bool
getter/setter pair

Methods

changeActiveCounter(int change) → void
clearObserver() → void
considerNotify(ObserverWrapper<T> observer) → void
dispatchingValue(ObserverWrapper<T>? observerWrapper) → void
getValue() → T
getVersion() → int
hasActiveObservers() → bool
hasObservers() → bool
listen(Observer<T> observer, {BaseViewState<StatefulWidget, ViewModel>? lifecycleOwner}) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onActive() → void
Called when the number of active observers change from 0 to 1.
onInactive() → void
Called when the number of active observers change from 1 to 0. This does not mean that there are no observers left, there may still be observers but their lifecycle states aren't {@link Lifecycle.State#STARTED} or {@link Lifecycle.State#RESUMED} (like an Activity in the back stack).
removeObserver(Observer<T> observer) → void
removeObservers(BaseViewState<StatefulWidget, ViewModel> owner) → void
setValue(T data) → void
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

startVersion → const int