Dart Programming - Map.clear() Function



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() :{} 
dart_programming_map.htm
Advertisements