我尝试使用不同的语法来删除 List<Map<String, Object>> _work;
但它仍然失败并且出错
type 'MappedListIterable' is not a subtype of type 'List<Map<String, Object>> .....
MappedListIterable is from dart:_internal
List is from dart:core
Mapis is from dart:core
String is from dart:core
Object is from dart:core
.....
我想声明一个变量,它是一个Map的列表,其中键是String,值是Object . 我该怎么办?
非常感谢任何帮助
1 回答
缺少
.toList()
使MappedListIterable
成为正确的列表 . 如果在List
上调用.map()
,.where()
或类似函数,则会得到MappedListIterable
,并且只调用.toList()
(或其他迭代MappedListIterable
的方法)实现结果,因为此类操作是惰性的并且延迟到实际访问结果为止 .或者,您也许可以改变
至