Ref class sealed Core
An object used by providers to interact with other providers and the life-cycles of the application.
See also:
- Annotations
-
- @optionalTypeArgs
- @publicInRiverpodAndCodegen
Properties
- container → ProviderContainer
-
The ProviderContainer that this provider is associated with.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isFirstBuild → bool
-
Whether we're initializing this provider for the first time.
final
- isRefresh → bool
-
Whether the provider was recomputed without any dependency change.
no setter
- isReload → bool
-
Whether the provider was recomputed after at least one dependency changed.
final
- mounted → bool
-
Whether this Ref is still active.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unsafe_checkIfMounted ↔ bool
-
An option flag to disable the exception when a Ref/Notifier is interacted
after it has been disposed.
getter/setter pair
Methods
-
exists(
ProviderBase< Object?> provider) → bool - Determines whether a provider is initialized or not.
-
invalidate(
ProviderOrFamily providerOrFamily, {bool asReload = false}) → void - Invalidates the state of the provider, destroying the state immediately and causing the provider to rebuild at some point in the future.
-
invalidateSelf(
{bool asReload = false}) → void - Invokes invalidate on itself.
-
keepAlive(
) → KeepAliveLink - Requests for the state of a provider to not be disposed when all the listeners of the provider are removed.
-
listen<
T> (ProviderListenable< T> provider, void listener(T? previous, T next), {void onError(Object error, StackTrace stackTrace)?, bool weak = false, bool fireImmediately = false}) → ProviderSubscription<T> -
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
-
notifyListeners(
) → void - Notify dependents that this provider has changed.
-
onAddListener(
void cb()) → RemoveListener - A life-cycle for whenever a new listener is added to the provider.
-
onCancel(
void cb()) → RemoveListener - Add a listener to perform an operation when the last listener of the provider is removed.
-
onDispose(
void listener()) → RemoveListener - Adds a listener to perform an operation right before the provider is destroyed.
-
onRemoveListener(
void cb()) → RemoveListener - A life-cycle for whenever a listener is removed from the provider.
-
onResume(
void cb()) → RemoveListener - A life-cycle for when a provider is listened again after it was paused (and onCancel was triggered).
-
read<
T> (ProviderListenable< T> listenable) → T - Read the state associated with a provider, without listening to that provider.
-
refresh<
T> (Refreshable< T> refreshable) → T - Forces a provider to re-evaluate its state immediately, and return the created value.
-
toString(
) → String -
A string representation of this object.
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.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited