Skip to content

Instantly share code, notes, and snippets.

@BbsonLin
Created February 27, 2019 08:10
Show Gist options
  • Save BbsonLin/98ea049a8465840c46ec33e1634537a6 to your computer and use it in GitHub Desktop.
Save BbsonLin/98ea049a8465840c46ec33e1634537a6 to your computer and use it in GitHub Desktop.
Map.forEach usage
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);
}
@BbsonLin
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment