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
-
- @sealed
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
-
debugChildren
→ Set<
ProviderContainer> -
All the containers that have this container as
parent
.no setter - debugId → String
-
A unique ID for this object, used by the devtool to differentiate two ProviderContainer.
no setter
-
debugProviderElements
→ List<
ProviderElement> -
The states of the providers associated to this ProviderContainer, sorted
in order of dependency.
no setter
-
debugProviderValues
→ Map<
ProviderBase, Object?> -
The value exposed by all providers currently alive.
no setter
-
debugVsyncs
→ DoubleLinkedQueue<
void Function()> -
A debug utility used by
flutter_riverpod
/hooks_riverpod
to check if it is safe to modify a provider.final - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void - Release all the resources associated with this ProviderContainer.
-
listen<
Result> (ProviderListenable< Result> provider, {void mayHaveChanged(ProviderSubscription<Result> sub)?, void didChange(ProviderSubscription<Result> sub)?}) → ProviderSubscription<Result> - Subscribe to this provider.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read<
Result> (ProviderBase< Object?, Result> provider) → Result - Reads a provider without listening to it and returns the currently exposed value.
-
readProviderElement<
Created, Listened> (ProviderBase< Created, Listened> provider) → ProviderElement<Created, Listened> - Reads the state of a provider, potentially creating it in the process.
-
refresh<
Created> (RootProvider< Created, Object?> provider) → Created - Forces a provider to re-evaluate its state immediately, and return the created value.
-
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