FutureResource<T> class
An observable wrapper around an asynchronous operation that supports cancellation and an optional option to preserve the last successful result while the new operation runs.
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
FutureResourceValue< T> > - FutureResource
- Implementers
- Available extensions
Constructors
Properties
- error → Object?
-
The current error, if any.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isLoading → bool
-
Whether the resource is currently loading.
no setter
- result → T?
-
The most recent successful result, if available.
no setter
-
retryOnError
↔ Future<
T> ? Function(Object error, int attempt)? -
A method that is called to retry an action when an error occurs,
if it returns null the last error will used in the error state
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
value
↔ FutureResourceValue<
T> -
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
cancel(
) → void - Cancel the currently running operation, if any.
-
dispose(
) → void -
Dispose the resource and cancel any active operation.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
pipe(
{required Widget loading(BuildContext context), required Widget error(BuildContext, Object), required Widget value(BuildContext, T value)}) → Widget - Build widgets that react to the current loading / error / value states of this resource.
-
pipe(
Widget builder(BuildContext context)) → ListenableBuilder -
Available on Listenable, provided by the CesiumListenableX extension
Build aListenableBuilderfor thisListenable. -
pipe(
{required Widget loading(BuildContext context), required Widget error(BuildContext, Object), required Widget value(BuildContext, T value)}) → Widget -
Available on ValueNotifier<
Build widgets that react to the current loading / error / value states of this resource.FutureResourceValue< , provided by the CesiumValueNotifierFutureResourceX extensionT> > -
pipeChild(
Widget builder(BuildContext context, Widget? child), {Widget? child}) → ListenableBuilder -
Available on Listenable, provided by the CesiumListenableX extension
Likepipebut supplies a staticchildto the builder. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
runNewFuture(
Future< T> newFuture(), [T? optimisticValue]) → void -
Start a new asynchronous operation, cancelling any prior one. If
_perserveResultis true the previous successful result is kept visible while the new operation runs. ifoptimisticValueis passed it will be the value in result until a new value arrives -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited