FutureProviderElement<T> class
The element of a FutureProvider
- Inheritance
-
- Object
- ProviderElementBase<
AsyncValue< T> > - FutureProviderElement
- Implemented types
Constructors
-
FutureProviderElement(_FutureProviderBase<
T> _provider) - The element of a FutureProvider
Properties
- container → ProviderContainer
-
The ProviderContainer that owns this ProviderElementBase.
no setterinherited
- debugAssertDidSetStateEnabled → bool
-
Whether the assert that prevents requireState from returning
if the state was not set before is enabled.
no setterinherited
-
future
→ Future<
T> -
Obtains the Future associated to this provider.
no setteroverride
-
futureNotifier
→ ProxyElementValueNotifier<
Future< T> > -
An observable for FutureProvider.future.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether this ProviderElementBase is currently listened to or not.
no setterinherited
- mounted → bool
-
Whether the element was disposed or not
no setterinherited
-
origin
→ ProviderBase<
Object?> -
The provider associated with this ProviderElementBase, before applying overrides.
no setterinherited
-
provider
→ ProviderBase<
AsyncValue< T> > -
The provider associated with this ProviderElementBase, after applying overrides.
no setterinherited
-
requireState
→ AsyncValue<
T> -
Read the current value of a provider and:
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
↔ AsyncValue<
T> -
Handles manual state change (as opposed to automatic state change from
listening to the Future).
getter/setter pairinherited
Methods
-
buildState(
) → void -
Invokes create and handles errors.
inherited
-
create(
{required bool didChangeDependency}) → void -
Initialize a provider.
override
-
debugReassemble(
) → void -
A life-cycle executed when a hot-reload is performed.
inherited
-
dispose(
) → void -
Release the resources associated to this ProviderElementBase.
inherited
-
exists(
ProviderBase< Object?> provider) → bool -
Determines whether a provider is initialized or not.
inherited
-
flush(
) → void -
A utility for re-initializing a provider when needed.
inherited
-
getState(
) → Result< AsyncValue< ?T> > -
Obtains the current state, or null if the provider has yet to initialize.
inherited
-
handleFuture(
FutureOr< T> create(), {required bool didChangeDependency}) → void -
Listens to a Future and convert it into an AsyncValue.
inherited
-
handleStream(
Stream< T> create(), {required bool didChangeDependency}) → void -
Listens to a Stream and convert it into an AsyncValue.
inherited
-
invalidate(
ProviderOrFamily provider) → void -
Invalidates the state of the provider, destroying the state immediately
and causing the provider to rebuild at some point in the future.
inherited
-
invalidateSelf(
) → void -
Invalidates the state of the provider, causing it to refresh.
inherited
-
keepAlive(
) → KeepAliveLink -
Requests for the state of a provider to not be disposed when all the
listeners of the provider are removed.
inherited
-
listen<
T> (ProviderListenable< T> listenable, void listener(T? previous, T value), {void onError(Object error, StackTrace stackTrace)?, bool fireImmediately = false, void onDependencyMayHaveChanged()?}) → ProviderSubscription<T> -
Listen to a provider and call
listener
whenever its value changes.inherited -
listenSelf(
void listener(AsyncValue< T> ? previous, AsyncValue<T> next), {void onError(Object error, StackTrace stackTrace)?}) → void -
Listens to changes on the value exposed by this provider.
inherited
-
mayNeedDispose(
) → void -
Life-cycle for when a listener is removed.
inherited
-
mount(
) → void -
Called the first time a provider is obtained.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Notify dependents that this provider has changed.
inherited
-
onAddListener(
void cb()) → void -
A life-cycle for whenever a new listener is added to the provider.
inherited
-
onCancel(
void cb()) → void -
Add a listener to perform an operation when the last listener of the provider
is removed.
inherited
-
onData(
AsyncData< T> value, {bool seamless = false}) → void -
Life-cycle for when a data from the provider's "build" method is received.
inherited
-
onDispose(
void listener()) → void -
Adds a listener to perform an operation right before the provider is destroyed.
inherited
-
onError(
AsyncError< T> value, {bool seamless = false}) → void -
Life-cycle for when an error from the provider's "build" method is received.
inherited
-
onRemoveListener(
void cb()) → void -
A life-cycle for whenever a listener is removed from the provider.
inherited
-
onResume(
void cb()) → void -
A life-cycle for when a provider is listened again after it was paused
(and onCancel was triggered).
inherited
-
read<
T> (ProviderListenable< T> provider) → T -
Read the state associated with a provider, without listening to that provider.
inherited
-
readProviderElement<
T> (ProviderBase< T> provider) → ProviderElementBase<T> -
Reads the state of a provider, potentially creating it in the process.
inherited
-
readSelf(
) → AsyncValue< T> -
Returns the currently exposed by a provider
inherited
-
refresh<
T> (Refreshable< T> provider) → T -
Forces a provider to re-evaluate its state immediately, and return the created value.
inherited
-
runOnDispose(
) → void -
Executes the Ref.onDispose listeners previously registered, then clear
the list of listeners.
inherited
-
setState(
AsyncValue< T> newState) → void -
Update the exposed value of a provider and notify its listeners.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
ProviderBase< AsyncValue< newProvider) → voidT> > -
Called when the override of a provider changes.
inherited
-
updateShouldNotify(
AsyncValue< T> previous, AsyncValue<T> next) → bool -
Called when a provider is rebuilt. Used for providers to not notify their
listeners if the exposed value did not change.
inherited
-
visitAncestors(
void visitor(ProviderElementBase element)) → void -
Visit the ProviderElementBases that this provider is listening to.
inherited
-
visitChildren(
{required void elementVisitor(ProviderElementBase element), required void notifierVisitor(ProxyElementValueNotifier element)}) → void -
Visit the ProviderElements of providers that are listening to this element.
inherited
-
watch<
T> (ProviderListenable< T> listenable) → T -
Obtains the state of a provider and causes the state to be re-evaluated
when that provider emits a new value.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited