operator + method

Map<K, V> operator +(
  1. Map<K, V> other
)

Adds all key-value pairs from other to the current map and returns a new map.

Example usage:

void main() {
  Map<String, int> map1 = {
    'a': 1,
    'b': 2,
  };

  Map<String, int> map2 = {
    'b': 3,
    'c': 4,
  };

  Map<String, int> combinedMap = map1 + map2;
  print(combinedMap); // Output: {a: 1, b: 3, c: 4}
}

Implementation

Map<K, V> operator +(Map<K, V> other) => {...this}..addAll(other);