Why does this JSON no longer deserialize into `Checklist<Map<String, dynamic>>`?

**SOLVED**

That is the code pattern:

“`dart
import ‘dart:convert’;

void primary() {
ultimate uncooked = ”’
[
{“code”:”ab”,”name”:”Abkhaz”,”nativeName”:”аҧсуа”},
{“code”:”aa”,”name”:”Afar”,”nativeName”:”Afaraf”},
{“code”:”za”,”name”:”Zhuang, Chuang”,”nativeName”:”Saɯ cueŋƅ, Saw cuengh”}
]
”’;

ultimate Checklist<Map<String, dynamic>> information = json.decode(uncooked);
print(information);
}
“`

This JSON, as you’ll see, will have to deserialize into `Checklist<Map<String, dynamic>>`. Alternatively, the `ultimate Checklist<Map<String, dynamic>> information = json.decode(uncooked);` line fails on runtime pronouncing:

“`simple
: TypeError: Example of ‘Checklist<dynamic>’: kind ‘Checklist<dynamic>’ isn’t a subtype of kind ‘Checklist<Map<String, dynamic>>’Error: TypeError: Example of ‘Checklist<dynamic>’: kind ‘Checklist<dynamic>’ isn’t a subtype of kind ‘Checklist<Map<String, dynamic>>’
“`

For some explanation why, Dart resolves the knowledge as `Checklist<dynamic>`, which will have to be `Checklist<Map<String, dynamic>>`. How can I remedy this?

Thank you upfront.



View Reddit via erayerdinView Supply

You may also like...

WP2Social Auto Publish Powered By : XYZScripts.com