Dart Programming - Map.addAll() Function



The Map.addAll() function adds all key-value pairs of other to this map.

Syntax

Map.addAll(Map<K, V> other) 

Parameter

  • other − represents a key value pair.

Return Type − void

Example

void main() { 
   Map m = {'name':'Tom','Id':'E1001'}; 
   print('Map :${m}'); 
   
   m.addAll({'dept':'HR','email':'tom@xyz.com'}); 
   print('Map after adding  entries :${m}'); 
} 

It will produce the following output

Map : {name: Tom, Id: E1001} 
Map after adding entries : {name: Tom, Id: E1001, dept: HR, email: tom@xyz.com}
dart_programming_map.htm
Advertisements