I have a Map data.
Map<String , Map<String, List<int>>> data = {"value":{"it":[ 1666117800000,1666204200000,1666290600000 ],
"mt":[1666463400000,1666549800000,1666636200000]}};
I want to print it and mt values form this Map.
CodePudding user response:
void main() {
Map<String , Map<String, List<int>>> data = {"value":{"it":[ 1666117800000,1666204200000,1666290600000 ],
"mt":[1666463400000,1666549800000,1666636200000]}};
for (var it in data["value"]!["it"]!) {
print(it);
}
print("");
for (var mt in data["value"]!["mt"]!) {
print(mt);
}
}
CodePudding user response:
accessing value from map is by using the key
print(data['value']?['it']);
print(data['value']?['mt']);
use ?
means its nullable value
CodePudding user response:
void main() {
Map<String, Map<String, List<int>>> data = {
"value": {
"it": [1666117800000, 1666204200000, 1666290600000],
"mt": [1666463400000, 1666549800000, 1666636200000]
}
};
Map<String, List<int>>? _value = data['value'];
print(_value);
print(_value!['it']);
print(_value!['mt']);
}