Created
February 27, 2019 08:10
-
-
Save BbsonLin/98ea049a8465840c46ec33e1634537a6 to your computer and use it in GitHub Desktop.
Map.forEach usage
This file contains 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() { | |
Map<String, List> menuData = { | |
"food": [ | |
{"title": "火腿堡", "price": 35.0, "count": 0}, | |
{"title": "香雞堡", "price": 40.0, "count": 0} | |
], | |
"drink": [ | |
{"title": "鮮奶茶", "price": 30.0, "count": 0}, | |
{"title": "咖啡", "price": 35.0, "count": 0} | |
] | |
}; | |
List orders = []; | |
menuData.forEach((String k, List v) { | |
orders += v; | |
}); | |
print(orders); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
View in DartPad:
https://dartpad.dartlang.org/98ea049a8465840c46ec33e1634537a6