I tried delcaring a List<Map<String, Object>> _work;
with different syntax but it still failed and gave an error
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
.....
I want to declare a variable which is a list of Map with key being String and value being Object. How should I do it?
Many thanks for any helps
There is a .toList()
missing to make the MappedListIterable
a proper list. If you call .map()
, .where()
, or similar functions on a List
, you get a MappedListIterable
, and only calling .toList()
(or other ways that iterate the MappedListIterable
) materialize the result, because such operations are lazy and delayed until the result is actually accessed.
Alternatively you might be able to change
List<Map<String, Object>> _work;
to
Iterable<Map<String, Object>> _work;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With