Dart Programming – Map.clear() Function

  • Post author:
  • Post category:Dart
  • Post comments:2 Comments
Dart Programming map.clear() Function

In this guide, we will discuss Map.clear() Function in Dart Programming Language. Removes all pairs from the map.

Syntax

Map.clear() 

Return Type − void

Example

void main() { 
   Map m = {'name':'Tom','Id':'E1001'}; 
   print('Map :${m}'); 
   
   m.clear(); 
   print('Map after invoking clear()  :${m}'); 
} 

It will produce the following output −

Map :{name: Tom, Id: E1001} 
Map after invoking clear()  :{} 

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply