当前位置:网站首页>Flutter | 指定页面回传值的类型
Flutter | 指定页面回传值的类型
2022-07-23 12:08:00 【无夜之星辰】
Navigator.push(context,
MaterialPageRoute(builder: (context) => _Page2()))
.then((value) {
print('回传的值是===$value');
});
因为 push 方法的的返回值类型是:Future<dynamic>:

所以 .then 这里的 value 是 dynamic 类型的。
有时我们想拿 value 的某个属性,这个时候 dynamic 就不好用了。
解决方案1:
类型转换:
final model = value as String;
解决方案2:
指定回传值的类型:
Navigator.push<String>
边栏推荐
- Redis master-slave replication
- From the big guy baptism! 2022 headline first hand play MySQL advanced notes, and it is expected to penetrate P7
- MySQL - master-slave replication
- The difference between deadlock, hunger and dead cycle
- A quietly rising domestic software is too strong!
- 激光共聚焦如何选择荧光染料
- Bean Validation规范篇----03
- CONDA set up proxy
- Cloud native (11) | kubernetes chapter kubernetes principle and installation
- Remote system command execution
猜你喜欢
![[attack and defense world web] difficulty Samsung 9 points introductory question (Part 1): simple_ js、mfw](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[attack and defense world web] difficulty Samsung 9 points introductory question (Part 1): simple_ js、mfw

JS filter / replace sensitive characters

(Zset) how is the underlying layer of redis stored with a hop table
![[operation and maintenance] SSH tunneling relies on the 22 port of SSH to realize the interface service of accessing the remote server](/img/4a/7156470e8d96c7709001bac88e872c.png)
[operation and maintenance] SSH tunneling relies on the 22 port of SSH to realize the interface service of accessing the remote server

sqlnet.ora文件设置不对造成ORA-12154 、ORA-01017连接异常

It's too hard! Tencent T4 boss was still staying up late at 4 a.m. and was actually sorting out the distributed transaction notes

MySQL-字符串按照数值排序

现代商业无代码开发平台的治理和网络安全

Unity-笔记-ILRuntime接入

Bean Validation入门篇----02
随机推荐
Redis sentinel mode
A quietly rising domestic software is too strong!
After Effects 教程,如何在 After Effects 中创建动画?
软件详细设计模板
[attack and defense world web] difficulty Samsung 9-point introductory question (middle): ics-05, easytornado
Redis' expiration strategy and memory elimination mechanism. Why didn't you release memory when the key expired
虚拟主播、偶像代言产品出问题谁负责?律师解析
MySQL - six logs
Three handling strategies of deadlock
黑马程序员-接口测试-四天学习接口测试-第三天-postman高级用法,newman例集导出导入,常用断言,断言json数据,工作原理,全局,环境变量,时间戳,请求前置脚本,关联,批量执行测试用例
Details of task switching
Dark horse programmer - interface test - four day learning interface test - third day - advanced usage of postman, export and import of Newman case set, common assertions, assertion JSON data, working
table自定义表格的封装
七、jmeter发出请求的逻辑
VRRP+MSTP配置详解【华为eNSP实验】
lc marathon 7.23
CONDA set up proxy
CS5363,CS5350,CS5328几款太阳能板电池充电管理IC的功能特性与参数对比
Redis key has no expiration time set. Why was it actively deleted
Bean validation specification ----03