当前位置:网站首页>Flutter03 dart asynchronous
Flutter03 dart asynchronous
2022-04-22 02:48:00 【weixin_ forty-two million five hundred and eighty thousand six 】
Dart asynchronous
Future
Dart Is a single thread programming language
- Future Object encapsulates Dart Asynchronous operation of , It has unfinished (uncompleted) And completed (completed) Two kinds of state .
- completed There are two states : One is the success of the operation , Return results ; The other is the failure of the operation , Returns an error .
1.1 then
void main(List<String> arguments) {
print('start');
Future f = getNetwort();
print(f.then((value) => print(value)).catchError((onError){
print(onError);
}));
print('end');
}
Future<String> getNetwort(){
return Future((){
sleep(Duration(seconds: 2));
// throw Exception('403');
return "yh";
});
}
//start
//Instance of 'Future<void>'
//end
//yh
//Exception: 403
1.2 async and await
版权声明
本文为[weixin_ forty-two million five hundred and eighty thousand six ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220247503402.html
边栏推荐
- On the attention economy of NFT
- 【※ LeetCode 剑指 Offer 12. 矩阵中的路径(简单)】
- Pytorch image classification: the official demo of pytorch implements a classifier (lenet)
- Introduction of explanatory variables in code refactoring
- Analysis on the development status of meta universe
- [论文阅读] Active Class Incremental Learning for Imbalanced Datasets
- Text processing - sed
- Stackoverflow:IActionContextAccessor Is Null
- Training set: alexnet classification
- 创建双向链表(详解)
猜你喜欢
![[※ leetcode sword finger offer 13. Motion range of robot (simple)]](/img/b6/16d99754284dd7f17081651b3cb354.png)
[※ leetcode sword finger offer 13. Motion range of robot (simple)]

How did opensea become the most popular NFT market?

Five cool login pages that can be used

On the attention economy of NFT

Or1k startup file analysis

Complete solution of closure operation in Discrete Mathematics

Development management · Huawei IPD

Authentication and access control
![[➾ leetcode Sword means offer 12. Path in Matrix (simple)]](/img/88/2c1c7a9954d824495f0b99223ce7fc.png)
[➾ leetcode Sword means offer 12. Path in Matrix (simple)]

身份认证和访问控制
随机推荐
Oracle table Association divergence
Inductive bias
用zlib压缩、解压缩流、判断是否压缩过了
Software testing · bad taste
go使用options模式设置参数
顺序表实现栈的操作
金融信息安全实训——22/4/19(上)
【※ LeetCode 剑指 Offer 13. 机器人的运动范围(简单)】
开发管理·华为IPD
Problem brushing plan -- dynamic programming (I)
Game + NFT, another feasible scene from virtual to real
【小杨带你玩转C语言】循环结构(详解篇)
Swift 通用类型AnyObject与Any的使用
IIS提示:“此网站要求您登录”的解决办法。
(advanced usage) C language string function
Can initialization process
Excel tips - vlookup automatic matching
Quick start NFT from technical principle, mainstream platform and market prospect
二叉排序树基本性质详解
Day11 job