CompletableFuture<T> class
提供最大并发执行数的Future队列,防止并发突破内存溢出
Constructors
Properties
- error ↔ dynamic
-
错误信息
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- isComplete ↔ bool
-
是否完成
getter/setter pair
- isError ↔ bool
-
是否发生错误
getter/setter pair
- result ↔ T?
-
异步任务运行结果
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace ↔ StackTrace?
-
错误堆栈
getter/setter pair
Methods
-
cancel(
) → bool - 取消任务,无法取消正在运行的任务
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onCancel(
FutureOr< void> action()) → void - 取消事件
-
then<
R> (VoidCallback onValue, {Function? onError}) → void - 回调
-
toString(
) → String -
A string representation of this object.
inherited
-
wait(
) → Future< T> - 等待结果
-
whenComplete(
FutureOr< void> action()) → void - 无论是否完成,都发生回调事件
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
join<
T> (List< CompletableFuture< ? fs) → Future<T> >List< CompletableFuture< >T> > - 等待所有任务完成
-
runAsync<
T> (AsyncRun run, {FutureExecutor? futureExecutor}) → CompletableFuture< T> - 执行一个异步任务