FutureInvoker<T extends AsyncOperationNotifier<R, P>, R, P> class abstract

Turns Future based async operation to callback based state machine.

T is type of a parameter for execute, which must implement AsyncOperationNotifier with R and P. R is result type of the asynchronous operation. P is type of progress report.

Most of widget does not handle Future gracefully, so, this class helps translated Future based asynchronous operation to callback based notification.

Implementers

Constructors

FutureInvoker({required R defaultResult, AsyncErrorHandler? canceledOperationErrorHandler, Equality<T> parameterEquality = const Equality(), String? debugLabel})
Creates new FutureInvoker.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status AsyncOperationStatus
AsyncOperationStatus of this invoker.
no setter

Methods

cancel() → void
Cancels pending operation.
execute(T parameter) → R?
Execute the asynchronous operation.
executeAsync(T parameter) FutureOr<R>
Do actual asynchronous operation. Note that the override can call AsyncOperationNotifier.onProgress in arbitrary timings and frequrencies.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset(R? newDefaultResult) → void
Resets this operation state to initial state with specified new initial value.
toString() String
A string representation of this object.
inherited

Operators

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