ProviderContainer class
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
.
- Annotations
Constructors
-
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.
Properties
- 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
.read-only - depth → int
-
How deep this ProviderContainer is in the graph of containers.
final
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- vsync → void Function(void task())
-
A function that controls the refresh rate of providers.
read-only
- vsyncOverride ↔ (void Function(void task())?)
-
A way to override vsync, used by Flutter to synchronize a container
with the widget tree.
read / write
Methods
-
debugReassemble(
) → void - Executes ProviderElementBase.debugReassemble on all the providers.
-
dispose(
) → void - Release all the resources associated with this ProviderContainer.
-
exists(
ProviderBase< Object?> provider) → bool - Determines whether a provider is initialized or not.
-
getAllProviderElements(
) → Iterable< ProviderElementBase< Object?> > -
Traverse the
ProviderElementBase
s associated with this ProviderContainer. -
getAllProviderElementsInOrder(
) → Iterable< ProviderElementBase< Object?> > - Visit all nodes of the graph at most once, from roots to leaves.
-
hasStateReaderFor(
ProviderListenable< Object?> provider) → bool - An internal utility for checking if a ProviderContainer has a fast path for reading a provider.
-
invalidate(
ProviderOrFamily provider) → void - {@template riverpod.invalidate}
-
listen<
State> (ProviderListenable< State> provider, void listener(State? previous, State next), {bool fireImmediately = false, void onError(Object error, StackTrace stackTrace)?}) → ProviderSubscription<State> -
Listen to a provider and call
listener
whenever its value changes. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pump(
) → Future< void> - Awaits for providers to rebuild/be disposed and for listeners to be notified.
-
read<
Result> (ProviderListenable< 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<
State> (Refreshable< State> provider) → State - {@template riverpod.refresh}
-
toString(
) → String -
A string representation of this object.
inherited
-
updateOverrides(
List< Override> overrides) → void - Updates the list of provider overrides.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited