Dart Programming – Map.addAll() Function

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

In this guide, we will discuss Map.addAll() Function in Dart Programming Language. 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}

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply