Line data Source code
1 : /// The database always gives back an `_InternalLinkedHasMap<dynamic, dynamic>`. 2 : /// This creates a deep copy of the json and makes sure that the format is 3 : /// always `Map<String, Object?>`. 4 34 : Map<String, Object?> copyMap(Map map) { 5 34 : final copy = Map<String, dynamic>.from(map); 6 68 : for (final entry in copy.entries) { 7 136 : copy[entry.key] = _castValue(entry.value); 8 : } 9 : return copy; 10 : } 11 : 12 34 : dynamic _castValue(dynamic value) { 13 34 : if (value is Map) { 14 34 : return copyMap(value); 15 : } 16 34 : if (value is List) { 17 28 : return value.map(_castValue).toList(); 18 : } 19 : return value; 20 : }