LCOV - code coverage report
Current view: top level - lib/src/utils - copy_map.dart (source / functions) Coverage Total Hit
Test: merged.info Lines: 100.0 % 9 9
Test Date: 2025-01-14 13:39:53 Functions: - 0 0

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

Generated by: LCOV version 2.0-1