Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dart forEach() on a Map
main() {
Map<String, int> map = {
'one': 1,
'two': 2,
'twelve': 12};
void iterateMapEntry(key, value) {
map[key] = value;
print('$key:$value');//string interpolation in action
}
map.forEach(iterateMapEntry);
}
@max6188

This comment has been minimized.

Copy link

@max6188 max6188 commented Jun 4, 2018

Guena!

@nixoncode

This comment has been minimized.

Copy link

@nixoncode nixoncode commented Aug 15, 2019

What about the Index?

@MisterioRee

This comment has been minimized.

Copy link

@MisterioRee MisterioRee commented Oct 29, 2019

What about the Index?
int i=0;
void iterateMapEntry(key, value) {
map[key] = value;
print('$key:$value at $i');//string interpolation in action
i++;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.