如何解决如何使用类在列表中插入数据?
编辑
谢谢大家的友好评论。
这很奇怪,但是昨天模拟器显示红色屏幕,显示type 'List<String>' is not a subtype of type 'List<Recyclable>' of 'function result'
。不知何故,当我今天重新运行模拟器以尝试再次解决该问题时,它运行良好!我会保留此帖子,以防万一有人发现它有用,并再次感谢大家的帮助!
原始帖子
我正在尝试遵循the flutter official website到(1)创建class
,(2)使用list
创建class
,(3)显示{{ 1}}使用list
。但是,终端说ListView
。我不知道为什么。
这是我的type 'List<String>' is not a subtype of type 'List<Recyclable>' of 'function result'
:
class
这是我的class Recyclable {
final String title;
final String description;
Recyclable(this.title,this.description);
}
:
list
这是我的List<Recyclable> recyclable = [
Recyclable('Plastic1','abc1'),Recyclable('Plastic2','abc2'),Recyclable('Plastic3','abc3'),Recyclable('Plastic4','abc4'),Recyclable('Plastic5','abc5'),Recyclable('Plastic6','abc6'),];
:
ListView
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。