deepCopyMap<K, V> function

Map<K, V>? deepCopyMap<K, V>(
  1. Map<K, V>? map, {
  2. Copier? copier,
})

Deeply copies map.

copier Copy Function for non-primitive types.

Implementation

Map<K, V>? deepCopyMap<K, V>(Map<K, V>? map, {Copier? copier}) {
  if (map == null) return null;
  if (map.isEmpty) return <K, V>{};
  return map.map((K k, V v) => MapEntry<K, V>(
      deepCopy(k, copier: copier) as K, deepCopy(v, copier: copier) as V));
}