AsyncNotifier<T> class

A ValueNotifier<T> that listens to Future and Stream snapshot.

Inheritance
Available extensions

Constructors

AsyncNotifier({T? data, Object? error, StackTrace stackTrace = StackTrace.empty, ConnectionState state = ConnectionState.none, void onData(T data)?, void onError(Object error, StackTrace stackTrace)?, void onDone()?, bool? cancelOnError})
Creates an AsyncNotifier instance with an initial value of type T.

Properties

cancelOnError bool?
Whether the subscription should be canceled when an error occurs.
final
data → T?

Available on ValueListenable<AsyncSnapshot<T>>, provided by the AsyncListenableExtension extension

no setter
error Object?

Available on ValueListenable<AsyncSnapshot<T>>, provided by the AsyncListenableExtension extension

no setter
errorMessage String?

Available on ValueListenable<AsyncSnapshot<T>>, provided by the AsyncListenableExtension extension

no setter
future Future<T>?
The Future currently being listened to.
getter/setter pair
hasData bool

Available on ValueListenable<AsyncSnapshot<T>>, provided by the AsyncListenableExtension extension

no setter
hasError bool

Available on ValueListenable<AsyncSnapshot<T>>, provided by the AsyncListenableExtension extension

no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
hasNone bool

Available on ValueListenable<AsyncSnapshot<T>>, provided by the AsyncListenableExtension extension

no setter
isLoading bool

Available on ValueListenable<AsyncSnapshot<T>>, provided by the AsyncListenableExtension extension

no setter
isReloading bool

Available on ValueListenable<AsyncSnapshot<T>>, provided by the AsyncListenableExtension extension

no setter
requireData → T

Available on ValueListenable<AsyncSnapshot<T>>, provided by the AsyncListenableExtension extension

no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
snapshot AsyncSnapshot<T>
The current AsyncSnapshot of this AsyncListenable.
no setter
stackTrace StackTrace?

Available on ValueListenable<AsyncSnapshot<T>>, provided by the AsyncListenableExtension extension

no setter
stream Stream<T>?
The Stream currently being listened to.
getter/setter pair
value AsyncSnapshot<T>
The current value stored in this notifier.
getter/setter pairoverride

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
cancel() → void
Unsubscribes to existing Future or Stream and sets snapshot to 'none'.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
onData(T data) → void
Callback when new data is available.
onDone() → void
Callback when the async operation is done.
onError(Object error, StackTrace stackTrace) → void
Callback when an error occurs.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator <<(Listenable other) → T

Available on T, provided by the ChangeNotifierSyncExtension extension

Receives notifications from a Listenable.
operator ==(Object other) bool
The equality operator.
inherited
operator >>(ChangeNotifier other) → T

Available on T, provided by the ListenableSyncExtension extension

Sends notifications to a ChangeNotifier.

Static Properties

observer AsyncNotifierObserver?
The current global observer for AsyncNotifier instances.
getter/setter pair