I'm trying to convert the following javascript object to a Dart map:
var users = {
1 : {
first_name: 'James',
last_name: 'Smith',
email: '[email protected]',
},
2 : {
first_name: 'Robin',
last_name: 'Doe',
email: '[email protected]',
}
I've tried:
var users = {
"1" : {
first_name: 'James',
last_name: 'Smith',
email: '[email protected]',
},
"2" : {
first_name: 'Robin',
last_name: 'Doe',
email: '[email protected]',
}
but I'm unable to use it as a map with the numbers in quotes or without(throws errors).
var keys = users.getKeys(); //NoSuchMethodError : method not found: 'getKeys'
assert(keys.length == 2);
assert(new Set.from(keys).contains('2'));