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 35 : Map<String, Object?> copyMap(Map map) { 5 35 : final copy = Map<String, dynamic>.from(map); 6 70 : for (final entry in copy.entries) { 7 140 : copy[entry.key] = _castValue(entry.value); 8 : } 9 : return copy; 10 : } 11 : 12 35 : dynamic _castValue(dynamic value) { 13 35 : if (value is Map) { 14 35 : return copyMap(value); 15 : } 16 35 : if (value is List) { 17 28 : return value.map(_castValue).toList(); 18 : } 19 : return value; 20 : }