AsyncNotifier<T> class
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
AsyncSnapshot< T> > - AsyncNotifier
- Mixed-in types
- Available extensions
Constructors
- AsyncNotifier({T? data, Object? error, StackTrace stackTrace = StackTrace.empty, ConnectionState state = ConnectionState.none, bool? cancelOnError})
-
Creates an
AsyncNotifierinstance with an initial value of typeT.
Properties
- cancelOnError → bool?
-
Whether the subscription should be canceled when an error occurs.
final
- connectionState → ConnectionState
-
Current state of connection to the asynchronous computation.
no setterinherited
- data → T?
-
The latest data received by the asynchronous computation.
no setterinherited
- error → Object?
-
The latest error object received by the asynchronous computation.
no setterinherited
- errorMessage → String?
-
Available on AsyncSnapshot<
Returns the error message if the error is an Exception with a message, otherwise returns the string representation of the error.T> , provided by the AsyncSnapshotExtension extensionno setter - errorMessage → String?
-
Available on AsyncSnapshot<
The error message of this AsyncSnapshot.error.T> , provided by the FlutterAsyncSnapshotExtension extensionno setter -
future
↔ Future<
T> ? -
The Future currently being listened to.
getter/setter pair
- hasData → bool
-
Returns whether this snapshot contains a non-null data value.
no setterinherited
- hasError → bool
-
Returns whether this snapshot contains a non-null error value.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- hasNone → bool
-
Available on AsyncSnapshot<
Returns whether this snapshot has neither data/error.T> , provided by the AsyncSnapshotExtension extensionno setter - isLoading → bool
-
Available on AsyncSnapshot<
Returns whether this snapshot is computing.T> , provided by the AsyncSnapshotExtension extensionno setter - isReloading → bool
-
Available on AsyncSnapshot<
Returns whether this snapshot is computing and has data/error.T> , provided by the AsyncSnapshotExtension extensionno setter - requireData → T
-
Returns latest data received, failing if there is no data.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace?
-
The latest stack trace object received by the asynchronous computation.
no setterinherited
-
stream
↔ Stream<
T> ? -
The Stream currently being listened to.
getter/setter pair
-
value
↔ AsyncSnapshot<
T> -
The current value stored in this notifier.
getter/setter pairinherited
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
-
inState(
ConnectionState state) → AsyncSnapshot< T> -
Returns a snapshot like this one, but in the specified
state.inherited -
maybeWhen<
R> ({bool skipLoading = false, R data(T data)?, R error(Object error, StackTrace stackTrace)?, R loading()?, R none()?, required R orElse()}) → R -
Available on AsyncSnapshot<
Allows you to define custom behavior for different states of an AsyncSnapshot by providing callbacks forT> , provided by the AsyncSnapshotExtension extensiondata,error,loading, andnone. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
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
-
when<
R> ({bool skipLoading = false, required R data(T data), required R error(Object error, StackTrace stackTrace), required R loading(), R none()?}) → R -
Available on AsyncSnapshot<
Allows you to define custom behavior for different states of an AsyncSnapshot by providing callbacks forT> , provided by the AsyncSnapshotExtension extensiondata,error,loading, andnone. -
whenData<
R> (R map(T data)) → AsyncSnapshot< R> -
Available on AsyncSnapshot<
AppliesT> , provided by the AsyncSnapshotExtension extensionmapwhen this snapshot hasData. -
whenError(
Object map(Object error)) → AsyncSnapshot< T> -
Available on AsyncSnapshot<
AppliesT> , provided by the AsyncSnapshotExtension extensionmapwhen this snapshot hasError. -
whenOrNull<
R> ({bool skipLoading = false, R data(T data)?, R error(Object error, StackTrace stackTrace)?, R loading()?, R none()?}) → R? -
Available on AsyncSnapshot<
Allows you to define custom behavior for different states of an AsyncSnapshot by providing callbacks forT> , provided by the AsyncSnapshotExtension extensiondata,error,loading, andnone.
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.