Future.delayed(Duration(seconds: 1), () {
return _getYouLikeRequest();
}).then((data) {
print('执行成功会走到这里${data}');
}).catchError((e) {
print('执行失败会走到这里');
print(e);
}).whenComplete(() {
print('无论成功或失败都会走到这里');
});
print('1111');
}
_getYouLikeRequest() async {
var responce = await Dio()
.get('url');
return responce.data;
}
网友评论