AsyncProvider<T> class

Inheritance
Available extensions

Constructors

AsyncProvider(FutureOr<T> builder(Ref<AsyncValue<T>> ref), {bool autoDispose = false, Duration autoDisposeDelay = Duration.zero, String? name})
Riverpod-compatible constructor: AsyncProvider((ref) async => value, ...).
AsyncProvider.args(Record? _args, {bool autoDispose = false, Duration autoDisposeDelay = Duration.zero, String? name})
Constructor for subclasses: class Y extends AsyncProvider<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
future Provider<Future<T>>
Provider that exposes the current future value for this async provider.
no setter
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
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(Ref<AsyncValue<T>> ref) FutureOr<T>
Builds the provider value.
makeData(T value) AsyncValue<T>
Creates a data value.
makeError(Object e, StackTrace st, [T? previous]) AsyncValue<T>
Creates an error value with optional previous data.
makeLoading([T? previous]) AsyncValue<T>
Creates a loading value, optionally carrying a previous value.
makeRefreshing(T value) AsyncValue<T>
Creates a data value marked as refreshing.
mutate<R>(MutationToken<R> token, Future<R> body(Ref<AsyncValue<T>> ref), {Concurrency concurrency = Concurrency.concurrent}) Call<R, AsyncValue<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<AsyncValue<T>>

Available on AsyncProvider<T>, provided by the AsyncProviderOverrideCompat extension

Creates an override for this async provider using a compatible factory.
overrideWithBuild(AsyncValue<T> builder(Ref<AsyncValue<T>> ref, AsyncProvider<T> notifier)) ProviderOverride<AsyncValue<T>>

Available on AsyncProvider<T>, provided by the AsyncProviderOverrideCompat extension

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

Available on AsyncProvider<T>, provided by the AsyncProviderOverrideCompat extension

Creates an override that always returns value.
run<R>(Future<R> body(Ref<AsyncValue<T>> ref)) Call<R, AsyncValue<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