AsyncNotifier<T> class
abstract
An AsyncNotifier is a notifier that holds the state of an AsyncSnapshot. It is used for business logic that depends on asynchronous operations.
- Implemented types
Constructors
Properties
- customDebugLabel → String?
-
Override this to provide a custom debug label.
no setterinherited
- debugLabel → String
-
A label to be used in debug messages and
by the RefenaTracingPage.
no setterinherited
-
dependencies
→ Set<
BaseNotifier> -
A collection of notifiers that this notifier depends on.
finalinherited
-
dependents
→ Set<
BaseNotifier> -
A collection of notifiers that depend on this notifier.
They will be disposed when this notifier is disposed.
finalinherited
- disposed → bool
-
Whether this notifier is disposed.
no setterinherited
-
future
↔ Future<
T> -
The future.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- prev → T?
-
The last valid state.
If the future is loading or errored, this will be the previous state.
If the future is completed, this will be the current data of the future.
Manipulating the
state
directly will not update this value.no setterinherited -
provider
→ BaseProvider<
BaseNotifier< ?AsyncValue< , AsyncValue<T> >T> > -
The provider that created this notifier.
This is only available after the initialization.
no setterinherited
- ref → Ref
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- savePrev → bool
-
Whether the previous state should be saved when setting the
future
. Override this, if you don't want to save the previous state. Manipulating thestate
directly will ignore this flag.no setterinherited -
state
↔ AsyncValue<
T> -
Gets the current state.
getter/setter pairinherited
Methods
-
describeState(
AsyncValue< T> state) → String -
Override this to provide a customized description of the state.
This is used by the built-in observers for improved logging.
inherited
-
dispose(
) → void -
This is called on Ref.dispose.
You can override this method to dispose resources.
inherited
-
init(
) → Future< T> -
Initializes the state of the notifier.
This method is called only once and
as soon as the notifier is accessed the first time.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
postInit(
) → void -
Override this to provide a custom post initialization.
The initial state is already set at this point.
inherited
-
setState(
Future< T> fn(NotifierSnapshot<T> snapshot)) → Future<T> - A helper method to set the state of the notifier.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateShouldNotify(
AsyncValue< T> prev, AsyncValue<T> next) → bool -
Override this if you want to a different kind of equality.
inherited
Operators
-
operator ==(
Object other) → bool -
Subclasses should not override this method.
It is used internally by
dependencies
anddependents
.inherited
Static Methods
-
test<
N extends BaseAsyncNotifier< (T> , T>{required N notifier, AsyncValue< T> ? initialState}) → AsyncNotifierTester<N, T> -
Returns a debug version of the
notifier
where you can set the state directly.