Skip to content

Instantly share code, notes, and snippets.

@Blasanka
Created January 16, 2020 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Blasanka/2329d52411daeff9317461f9626187db to your computer and use it in GitHub Desktop.
Save Blasanka/2329d52411daeff9317461f9626187db to your computer and use it in GitHub Desktop.
This is how iterate over dart map. Edit in DartPad https://dartpad.dartlang.org/2329d52411daeff9317461f9626187db
void main() {
var locations = {
{
'country': 'Egypt',
'city': 'Cairo',
'Latitude': 30.033333,
'Longitude': 31.233334,
'utcOffset': 2
},
{
'country': 'Thailand',
'city': 'Bangkok',
'Latitude': 13.7563,
'Longitude': 100.5018,
'utcOffset': 7
},
};
for (var element in locations) {
print(element["country"]);
}
// or
locations.forEach((element) => print(element["country"]));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment