I want to print a single value from a map.
var myMap = {
0: {
key: 754,
name: luke,
time: 1665537500000},
1: {
key: 436,
name: obi,
time: 1665532400000},
}
print(myMap[1].value("name"); // something like that
output should be: obi
CodePudding user response:
If you specify Map before "myMap", you should be able to use
print(myMap[1]["name"]);
CodePudding user response:
you need to achieve this way :
Map<dynamic, dynamic> myMap = {
0: {"key": 754, "name": "luke", "time": 1665537500000},
1: {"key": 436, "name": "obi", "time": 1665532400000},
};
print(myMap[1]["name"]);
}