How to check if map is empty in Dart

1 Answer

0 votes
void main() {
    var mp = {};
    
    if (mp.isEmpty) {
        print('Map is empty');
    } else {
        print('Map is not empty');
    }
}
 
 
 
 
 
/*
run:
 
Map is empty
 
*/

 



answered Oct 11, 2022 by avibootz

Related questions

1 answer 159 views
159 views asked Oct 11, 2022 by avibootz
1 answer 149 views
149 views asked Oct 12, 2022 by avibootz
2 answers 184 views
184 views asked Oct 10, 2022 by avibootz
1 answer 179 views
179 views asked Oct 9, 2022 by avibootz
1 answer 172 views
1 answer 153 views
...