Created
January 16, 2020 12:16
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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