Provider<T> class


Provider

Defines a synchronous provider that builds a value from Ref.

Inheritance
Available extensions

Constructors

Provider(T builder(Ref<T> ref), {bool autoDispose = false, Duration autoDisposeDelay = Duration.zero, String? name})
Riverpod-compatible constructor: Provider((ref) => value, ...).
Provider.args(Record? _args, {bool autoDispose = false, Duration autoDisposeDelay = Duration.zero, String? name})
Constructor for subclasses: class X extends Provider<T>.

Properties

args Record?
Arguments used to define provider identity for families.
no setteroverride
argument Object?
Exposes args for Riverpod compatibility.
no setterinherited
autoDispose bool
Whether to auto-dispose when there are no listeners.
no setteroverride
autoDisposeDelay Duration
Delay before auto-disposal when unused.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
key ProviderKey
Creates a key from the provider type and args.
no setterinherited
name String?
Optional debug name for this provider.
no setteroverride
notifier Provider<P>

Available on P, provided by the ProviderOverrideCompat extension

Returns a provider that exposes the notifier/instance for this provider.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(Ref<T> ref) → T
Builds the provider value.
mutate<R>(MutationToken<R> token, Future<R> body(Ref<T> ref), {Concurrency concurrency = Concurrency.concurrent}) Call<R, T>
Runs body as a tracked mutation with the given token.
mutation<R>([Symbol? symbol]) MutationToken<R>
Creates a mutation token owned by this provider.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
overrideWith(dynamic override) ProviderOverride<S>

Available on P, provided by the ProviderOverrideCompat extension

Creates an override for this provider using a compatible factory.
overrideWithBuild(S builder(Ref<S> ref, P notifier)) ProviderOverride<S>

Available on P, provided by the ProviderOverrideCompat extension

Creates an override that can access the original notifier.
overrideWithValue(S value) ProviderOverride<S>

Available on P, provided by the ProviderOverrideCompat extension

Creates an override that always returns value.
run<R>(Future<R> body(Ref<T> ref)) Call<R, T>
Runs body in the provider context without mutation tracking.
toString() String
Returns a debug-friendly string for this provider.
inherited

Operators

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