copyDeepMap function

Map<String, dynamic> copyDeepMap(
  1. Map<String, dynamic> map
)

Implementation

Map<String, dynamic> copyDeepMap(Map<String, dynamic> map) {
  Map<String, dynamic> newMap = {};

  map.forEach((String key, dynamic value) {
    if (value is Map<String, dynamic>) {
      newMap[key] = copyDeepMap(value);
    } else if (value is List<SelectionItemModel>) {
      newMap[key] = List<SelectionItemModel>.of(value);
    } else {
      newMap[key] = value;
    }
  });

  return newMap;
}