convertToJson function

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

Hive always gives back an _InternalLinkedHasMap<dynamic, dynamic>. This creates a deep copy of the json and makes sure that the format is always Map<String, dynamic>.

Implementation

Map<String, dynamic> convertToJson(Map map) {
  final copy = Map<String, dynamic>.from(map);
  for (final entry in copy.entries) {
    copy[entry.key] = _castValue(entry.value);
  }
  return copy;
}