TimedComputeOnce<V> class

A ComputeOnce that records when the computation is resolved.

The resolvedAt timestamp is set when the computation completes, regardless of success or failure.

Inheritance

Constructors

TimedComputeOnce(ComputeCall<V> call, {PosComputeCall<V>? posCompute, bool resolve = true})

Properties

className → String
The class name of this compute implementation.
no setteroverride
error → ({Object error, StackTrace stackTrace})?
Returns the cached error and stack trace if resolution failed, otherwise null.
no setterinherited
hasError → bool
Whether the cached result is an error.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
isResolved → bool
Whether the computation has completed (with value or error).
no setterinherited
isResolving → bool
Whether the computation is currently in progress and not yet resolved.
no setterinherited
posCompute ↔ PosComputeCall<V>?
Optional callback invoked after the computation completes.
getter/setter pairinherited
resolvedAt → DateTime?
The moment the computation was resolved, or null if not yet resolved.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
value → V?
Returns the cached value if already resolved, otherwise null.
no setterinherited

Methods

elapsedTime([DateTime? now]) → Duration
Returns the time elapsed since the computation was resolved.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onCompute(V? value, Object? error, StackTrace? stackTrace) → void
Callback invoked when the computation completes.
override
resolve({bool throwError = true, FutureOr<V> onError(Object error, StackTrace stackTrace)?, V? onErrorValue}) → FutureOr<V>
Resolves the computation and returns its value (V) or a Future<V>.
inherited
resolveAsync({bool throwError = true, Future<V> onError(Object error, StackTrace stackTrace)?, V? onErrorValue}) → Future<V>
Resolves the computation asynchronously.
inherited
then<R>(FutureOr<R> onValue(V value), {Function? onError}) → Future<R>
Chains a callback to the resolved value.
inherited
toString() → String
A string representation of this object.
inherited
whenComplete(FutureOr<void> action()) → Future<V>
Registers a callback to be executed when resolution completes, regardless of success or failure.
inherited
whenResolved<R>(FutureOr<R> onResolve(V? value, Object? error, StackTrace? stackTrace)) → Future<R>
Invokes a callback when this value resolves, either successfully or with an error, and maps the outcome to a new result.
inherited

Operators

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