In this guide, we will discuss Map.forEach() Function in Dart Programming Language. Applies the specified function on every Map entry. In other words, forEach enables iterating through the Map’s entries.
Syntax
Map.forEach(void f(K key, V value));
Parameters
- f(K key, V value) − Applies f to each key-value pair of the map.Calling f must not add or remove keys from the map
Return Type − void.
Example
void main() { var usrMap = {"name": "Tom", 'Email': 'tom@xyz.com'}; usrMap.forEach((k,v) => print('${k}: ${v}')); }
It will produce the following output −
name: Tom Email: tom@xyz.com
Next Topic : Click Here
Pingback: Dart Programming - Map.remove() Function | Adglob Infosystem Pvt Ltd
Pingback: Dart Programming - Map | Adglob Infosystem Pvt Ltd