How to check if map is not empty in Dart

1 Answer

0 votes
void main() {
    var mp = {'dart': 13, 'c': 89, 'c++': 10, 'python': 45};
    
    if (mp.isNotEmpty ) {
        print('Map is not empty');
    } else {
        print('Map is empty');
    }
}
 
 
 
 
 
/*
run:
 
Map is not empty
 
*/

 



answered Oct 11, 2022 by avibootz

Related questions

1 answer 134 views
134 views asked Oct 11, 2022 by avibootz
1 answer 140 views
140 views asked Oct 12, 2022 by avibootz
2 answers 167 views
167 views asked Oct 10, 2022 by avibootz
1 answer 165 views
165 views asked Oct 9, 2022 by avibootz
1 answer 160 views
1 answer 145 views
1 answer 172 views
...