CompletableFuture<T> class Null safety

提供最大并发执行数的Future队列,防止并发突破内存溢出

Constructors

CompletableFuture()

Properties

error ↔ dynamic
错误信息
read / write
hashCode int
The hash code for this object.
read-onlyinherited
isComplete bool
是否完成
read / write
isError bool
是否发生错误
read / write
result ↔ T?
异步任务运行结果
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
stackTrace StackTrace?
错误堆栈
read / write

Methods

cancel() bool
取消任务,无法取消正在运行的任务
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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<T>>? fs) Future<List<CompletableFuture<T>>>
等待所有任务完成
runAsync<T>(AsyncRun run, {FutureExecutor? futureExecutor}) CompletableFuture<T>
执行一个异步任务