ProviderContainer class Null safety

An object that stores the state of the providers and allows overriding the behavior of a specific provider.

If you are using Flutter, you do not need to care about this object (outside of testing), as it is implicitly created for you by ProviderScope.



ProviderContainer({ProviderContainer? parent, List<Override> overrides = const [], List<ProviderObserver>? observers})
An object that stores the state of the providers and allows overriding the behavior of a specific provider.


debugCanModifyProviders ↔ (void Function?()?)
A debug utility used by flutter_riverpod/hooks_riverpod to check if it is safe to modify a provider.
read / write
debugChildren List<ProviderContainer>
All the containers that have this container as parent.
debugId String
A unique ID for this object, used by the devtool to differentiate two ProviderContainer.
@visibleForTesting, read-only
depth int
How deep this ProviderContainer is in the graph of containers.
hashCode int
The hash code for this object.
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
vsync → void Function(void task())
A function that controls the refresh rate of providers.
vsyncOverride ↔ (void Function?(void task())?)
A way to override vsync, used by Flutter to synchronize a container with the widget tree.
read / write


dispose() → void
Release all the resources associated with this ProviderContainer.
getAllProviderElements() Iterable<ProviderElementBase>
Traverse the ProviderElementBases associated with this ProviderContainer.
getAllProviderElementsInOrder() Iterable<ProviderElementBase>
Visit all nodes of the graph at most once, from roots to leaves.
listen<State>(ProviderListenable<State> provider, void listener(State? previous, State next), {bool fireImmediately = false, void onError(Object error, StackTrace stackTrace)?}) ProviderSubscription<State>
Subscribe to this provider.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
pump() Future<void>
Awaits for providers to rebuild/be disposed and for listeners to be notified.
read<Result>(ProviderBase<Result> provider) → Result
Reads a provider without listening to it and returns the currently exposed value.
readProviderElement<State>(ProviderBase<State> provider) ProviderElementBase<State>
Reads the state of a provider, potentially creating it in the process.
refresh<Created>(ProviderBase<Created> provider) → Created
Forces a provider to re-evaluate its state immediately, and return the created value.
toString() String
A string representation of this object.
updateOverrides(List<Override> overrides) → void
Updates the list of provider overrides.


operator ==(Object other) bool
The equality operator.