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 177 views
2 answers 149 views
149 views asked Oct 11, 2022 by avibootz
2 answers 137 views
137 views asked Oct 11, 2022 by avibootz
2 answers 172 views
172 views asked Oct 11, 2022 by avibootz
1 answer 180 views
1 answer 169 views
1 answer 150 views
...