deepCopy method
Returns a new Map that contains a deep copy of every key and value from this.
Implementation
// ignore: use_to_and_as_if_applicable
Map<K, V> deepCopy() {
final copiedEntries = <MapEntry<K, V>>[];
// Deep copy every item and add it to [copy].
for (final MapEntry(:key, :value) in entries) {
final copiedKey = _deepCopy<K>(key);
final copiedValue = _deepCopy<V>(value);
copiedEntries.add(MapEntry<K, V>(copiedKey, copiedValue));
}
return Map<K, V>.fromEntries(copiedEntries);
}