ViewModel class abstract

Inheritance
Implementers

Constructors

ViewModel()

Properties

alertRequestQueue ↔ List<AlertRequest>
getter/setter pair
dirtyStateMonitor → DirtyStateMonitor
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
initializing → Future<void>
no setter
isDisposed → bool
Whether the widget that owned this view model has gone. Work that finishes later checks it before drawing.
no setter
isInitialised → bool
no setter
isLoading → bool
no setter
isRefreshing → bool
Whether the view shows a saved copy while the server is asked again (see watch). ViewModelWidget draws its refresh indicator over the view meanwhile; the view itself stays usable.
no setter
loadingIndicatorStyle ↔ LoadingIndicatorStyle
getter/setter pair
no setter
refreshError → Object?
Why the server could not be reached after a saved copy was drawn, if it could not. The copy stays on screen; the view can say it may be out of date. Cleared by cancelWatches and so by fromServer.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
cancelWatches() → void
Stops the background refreshes of earlier watches — call it before running a fetch again, so an answer meant for the last one does not arrive on top of the next — and clears refreshError. A watch still waiting for its first answer is left alone: something awaits it.
dispose() → void
Discards any resources used by the object.
override
fromServer<R>(Future<R> body()) → Future<R>
Runs body with every watch it makes forced to CacheStrategy.serverOnly, after cancelWatches. For a refresh the person asked for, or one after an action: neither wants a copy.
idle() → void
init() → void
initState() → Future<void>
loading({LoadingIndicatorStyle style = LoadingIndicatorStyle.auto}) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
redraw() → void
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setInitialised(bool initialised) → void
showErrorMessage(String message, {String? title}) → void
showInfoMessage(String message, {String? title}) → void
showWarningMessage(String message, {String? title}) → void
toString() → String
A string representation of this object.
inherited
watch<T>(CachedCall<T> call, void apply(T value), {CacheStrategy strategy = CacheStrategy.localThenServer}) → Future<void>
Reads call and hands each answer to apply, which assigns fields. Typical use is the whole of a fetch:

Operators

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