ChangeNotifierProviderElement<NotifierT extends ChangeNotifier?> class
The element of ChangeNotifierProvider.
- Inheritance
-
- Object
- ProviderElementBase<
NotifierT> - ChangeNotifierProviderElement
- Implemented types
-
- ChangeNotifierProviderRef<
NotifierT>
- ChangeNotifierProviderRef<
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
- 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
- notifier → NotifierT
-
The ChangeNotifier currently exposed by this provider.
no setteroverride
-
origin
→ ProviderBase<
Object?> -
The provider associated with this ProviderElementBase, before applying overrides.
no setterinherited
-
provider
→ ProviderBase<
NotifierT> -
The provider associated with this ProviderElementBase, after applying overrides.
no setterinherited
- requireState → NotifierT
-
Read the current value of a provider and:
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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< NotifierT> ? -
Obtains the current state, or null if the provider has yet to initialize.
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(NotifierT? previous, NotifierT 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
-
onDispose(
void listener()) → void -
Adds a listener to perform an operation right before the provider is destroyed.
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(
) → NotifierT -
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.
override
-
setState(
NotifierT 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< NotifierT> newProvider) → void -
Called when the override of a provider changes.
inherited
-
updateShouldNotify(
NotifierT previous, NotifierT next) → bool -
Called when a provider is rebuilt. Used for providers to not notify their
listeners if the exposed value did not change.
override
-
visitAncestors(
void visitor(ProviderElementBase element)) → void -
Visit the ProviderElementBases that this provider is listening to.
inherited
-
visitChildren(
{required void elementVisitor(ProviderElementBase< Object?> element), required void notifierVisitor(ProxyElementValueNotifier<Object?> element)}) → void -
Visit the ProviderElements of providers that are listening to this element.
override
-
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