包中的类 , 系统会默认导入该包中的类 , 直接使用即可 , 不需要刻意导入 ;
Future 有两种状态 :
① 执行中 , Pending 状态 ;
② 执行结果 , Complete 状态 ;...二、Future.then 使用
调用 then 方法 , 可以在该方法中 , 获取 Future 中的值 , 其类型是 Future 泛型中的类型 ;
调用 testFuture 方法后 , 调用 then...onError} 是可选的 , 用于捕获异常的方法 ;
三、Future 异常捕获
方式一 : then 方法传入 onError 参数 ;
在执行 返回值是 Future 类型的 testFuture...://dart.cn/
Dart 开发者官网 : https://api.dart.dev/
Flutter 中文网 : https://flutterchina.club/ , http://flutter.axuer.com.../animations/
博客源码下载 :
GitHub 地址 : https://github.com/han1202012/flutter_http( 随博客进度一直更新 , 有可能没有本博客的源码