flutter之出现 List is not a subtype of type 问题
问题复现
List’ is not a subtype of type 'List
截图如下
分析过程
- A.dart 调用 B.dart,B.dart B部分调用 B.dart中的C部分。
A.dart A部分
B.dart B代码部分
B.dart C代码部分
2. 可知 存在两次 map循环。看网上的解释说,
“虽然 children 的类型是 List ,但该信息不会回流到 map 调用 . 这可能是因为 map 之后是 toList ,因为没有办法输入注释闭包的返回 .”
解决方案
通过分析后,那么就给最后一次被调用的map处指明返回类型。这个说法类似java的范型 <范型> ,不知道说的对不对,别喷谢谢。
因为 每一次的循环得到的结果都是一个 widget,所以指明类型为 widget
B.dart 中B代码部分
flutter之出现 List is not a subtype of type 问题相关推荐
- flutter type ‘int‘ is not a subtype of type ‘String?‘
type 'int' is not a subtype of type 'String?' 不是int,将int改成String类型 Unhandled Exception: type 'double ...
- 【flutter】type ‘Null‘ is not a subtype of type ‘bool‘
type 'Null' is not a subtype of type 'bool' 类型不对 解决方法 判断返回的类型是否正确 print('类型:${data['isDayTime'].runt ...
- Dart或Flutter中解决异常-type ‘int‘ is not a subtype of type ‘double‘
文章目录 出现场景 解决方案 声明num(推荐) 判断类型 出现场景 服务端返回的金额数据可能是整数,也可能是小数. 无论我们按int或double来解析,都可能出错. 如果我们定义的类型是int,返 ...
- Flutter-解决Try catch出现异常:type ‘_TypeError‘ is not a subtype of type ‘Exception‘ in type cast
文章目录 出现场景 解决方案 分开处理(推荐) 判断类型 出现场景 使用Dio时,网络请求可能会出现异常,需要用try catch捕获. 捕获代码如下 try {var response = awai ...
- TypeError: super(type, obj): obj must be an instance or subtype of type这个问题怎么处理?
TypeError: super(type, obj): obj must be an instance or subtype of type这个问题怎么处理? 这个错误通常发生在使用super()函 ...
- Python提示 TypeError: super(type, obj): obj must be an instance or subtype of type问题
Python提示 TypeError: super(type, obj): obj must be an instance or subtype of type问题 简述问题 在工作中有一天将debu ...
- TypeError: super(type, obj): obj must be an instance or subtype of type
问题 今天学习<Python Web 开发实战>自定义转换器这一小节,书中有段代码如下: class ListConverter(BaseConverter):def __init__(s ...
- type ‘_Map<String, dynamic>‘ is not a subtype of type ‘Map<String, Object>‘
type '_Map<String, dynamic>' is not a subtype of type 'Map<String, Object>' 使用Map<Str ...
- TypeError: super(type, obj): obj must be an instance or subtype of type 该错误的一次处理
我在写maya类的时候遇到,版本python2.7 folder lib mayaclass.py base类 A(base)类 ui.py 其中A继承base ui.py文件中内容 #python2 ...
- I/flutter ( 7317): type ‘_Map<String, dynamic>‘ is not a subtype of type ‘Folder‘
记录一个bug,再记录一下自己的新"发现". 在flutter里面将后端获取的数据转换成本地模型的时候,在模型里面使用了其他模型类型(比如外键这种) 数据结构如下(JSON): { ...
最新文章
- meetup_如何使用标准库和Node.js构建Meetup Slack机器人
- 前端学习(1703):前端系列javascript之问题解答
- SQLite多线程使用总结
- Python学习之路和隐藏特征
- ICS/SCADA 系统的对比
- 6-2 多项式求值 (15 分)
- spring mvc项目在IDEA下使用jrebel热部署报错!!
- WebSocket请求过程分析及实现Web聊天室
- mac 上搭建SVN
- 《电路》邱关源 思维导图 第七章-一阶和二阶电路的时域分析
- 多线程总结--小码哥java
- mysql pid无法写入_ERROR /usr/libexec/mysqld:写入文件'/var/run/mysqld/mysqld.pid'时出错(错误代码:28)...
- 泰坦尼克号幸存者逻辑回归预测
- uniapp自定义导航栏与手机状态栏重叠问题
- java 实现写出倒立三角形的几种方法
- oracle安装实训心得,oracle实训总结
- 【Node.js】写一个数据自动整理成表格的脚本
- 在查找预编译头时遇到意外的文件结尾
- Nelder–Mead算法详解
- php 兼容火狐,HTML_总结CSS中火狐浏览器与IE浏览器的兼容代码,如何让你写的代码更兼容火狐 - phpStudy...
热门文章
- 获取用户的中文姓名,手机号,邮箱,地址,年龄等随机信息,MD5加密等常用的工具。
- 计算机原理 复位信号解释,复位电路原理
- 为什么老工程师不值钱了
- 宁波大学2014年高等代数考研试题
- 深入机器学习系列之:快速迭代聚类
- 微信小程序JavaScript语法介绍
- 俺也去了WinHec..............
- 突破电信80端口封锁,用CDN架设公司服务器!
- font标签的size属性
- 程序员删库跑路案例之 —— 这家网站首页变图片