AutoDisposeAsyncNotifier<State> class
abstract
A provider which creates and listens to an AsyncNotifier.
This is similar to FutureProvider but allows to perform side-effects.
The syntax for using this provider is slightly different from the others
in that the provider's function doesn't receive a "ref" (and in case
of family, doesn't receive an argument either).
Instead the ref (and argument) are directly accessible in the associated
AsyncNotifier.
When using autoDispose or family, your notifier type changes.
Instead of extending AsyncNotifier, you should extend either:
- AutoDisposeAsyncNotifier for
autoDispose - FamilyAsyncNotifier for
family - AutoDisposeFamilyAsyncNotifier for
autoDispose.family
Constructors
Properties
-
future
→ Future<
State> -
Obtains a Future that resolves with the first
statevalue that is not AsyncLoading.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
-
ref
→ AutoDisposeAsyncNotifierProviderRef<
State> -
The Ref from the provider associated with this AsyncNotifier.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
↔ AsyncValue<
State> -
The value currently exposed by this AsyncNotifier.
getter/setter pairinherited
Methods
-
build(
) → FutureOr< State> - Initialize an AsyncNotifier.
-
listenSelf(
void listener(AsyncValue< State> ? previous, AsyncValue<State> next), {void onError(Object error, StackTrace stackTrace)?}) → void -
Listens to changes on the value exposed by this provider.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
FutureOr< State> cb(State), {FutureOr<State> onError(Object err, StackTrace stackTrace)?}) → Future<State> -
A function to update
statefrom its previous value, while abstracting loading/error cases forstate.inherited -
updateShouldNotify(
AsyncValue< State> previous, AsyncValue<State> next) → bool -
A method invoked when the state exposed by this AsyncNotifier changes.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited