We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d6e30af commit 7612b85Copy full SHA for 7612b85
lib/src/imap/imap.dart
@@ -419,8 +419,8 @@ abstract class IMap<K, V> // ignore: must_be_immutable
419
/// toJsonK should return String, for safety key null is also implemented
420
///
421
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)));
+ unlock.map((key, value) =>
+ MapEntry(toJsonK(key)?.toString() ?? 'null', toJsonV(value)));
424
425
/// See also: [ImmutableCollection], [ImmutableCollection.lockConfig],
426
/// [ImmutableCollection.isConfigLocked],[flushFactor], [defaultConfig]
0 commit comments