We should iterate map based on the requirement.
-
If we required to iterate only keys
map.keys.forEach((k) => print("Key : $k"));
-
If we required to iterate only values
map.values.forEach((v) => print("Value: $v"));
-
If we required to iterate both key values.
map.forEach((k, v) => print("Key : $k, Value : $v"));