6-3 异步:Future与FutureBuilder实用技巧
实现异步编程
Future类似于ES6里面的Promise
3秒后打印出done
通过whenComplete来获取future执行结束后的结果。
timeout
执行时间设置为3秒。超时时间设置为2秒。
FutureBuilder的使用
结束
实现异步编程
Future类似于ES6里面的Promise
3秒后打印出done
通过whenComplete来获取future执行结束后的结果。
执行时间设置为3秒。超时时间设置为2秒。