Skip to content

Commit 7612b85

Browse files
author
Joan S
committed
fix issue marcglasberg#58
1 parent d6e30af commit 7612b85

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/src/imap/imap.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ abstract class IMap<K, V> // ignore: must_be_immutable
419419
/// toJsonK should return String, for safety key null is also implemented
420420
///
421421
Object toJson(Object? Function(K) toJsonK, Object? Function(V) toJsonV) =>
422-
unlock.map((key, value) => MapEntry(
423-
key == null ? 'null' : (toJsonK(key) as String), toJsonV(value)));
422+
unlock.map((key, value) =>
423+
MapEntry(toJsonK(key)?.toString() ?? 'null', toJsonV(value)));
424424

425425
/// See also: [ImmutableCollection], [ImmutableCollection.lockConfig],
426426
/// [ImmutableCollection.isConfigLocked],[flushFactor], [defaultConfig]

0 commit comments

Comments
 (0)