flutter 一直出现type ‘List<dynamic>‘ is not a subtype of type ‘List<Widget>‘
type 'List<dynamic>' is not a subtype of type 'List<Widget>'
一直出现这个错误 明明写的返回值没有问题 找了半个小时 for循环也试过了 一样的报错 后来看百度解决了
type 'List<dynamic>' is not a subtype of type 'List<Widget>'
// 这里的问题是类型推断以意想不到的方式失败。解决方案是为map方法提供类型参数
Wrap(
children:item['casts'].map<Widget>((casts){
return Text('data');
}).toList(),
)
更复杂的答案是,虽然类型children是List<Widget>&#x