How to print map in Dart

2 Answers

0 votes
void main() {
    var mp = {'dart': 13, 'c': 89, 'c++': 10, 'python': 45};
     
    print(mp);
}
 
 
 
 
 
/*
run:
 
{dart: 13, c: 89, c++: 10, python: 45}
 
*/

 



answered Oct 11, 2022 by avibootz
0 votes
void main() {
    var mp = {'dart': 13, 'c': 89, 'c++': 10, 'python': 45};
    
    mp.forEach((Object? key, Object? value) {
        print([key, value]);
    });
}
 
 
 
 
 
/*
run:
 
[dart, 13]
[c, 89]
[c++, 10]
[python, 45]
 
*/

 



answered Oct 11, 2022 by avibootz

Related questions

2 answers 165 views
2 answers 140 views
140 views asked Oct 11, 2022 by avibootz
2 answers 127 views
127 views asked Oct 11, 2022 by avibootz
2 answers 156 views
156 views asked Oct 11, 2022 by avibootz
1 answer 172 views
1 answer 160 views
1 answer 145 views
...