k-paxian / dart-json-mapper

Serialize / Deserialize Dart Objects to / from JSON
https://pub.dev/packages/dart_json_mapper
Other
400 stars 33 forks source link

type 'Null' is not a subtype of type 'Object' when serializing Null element in List and Set #190

Closed marco709394 closed 2 years ago

marco709394 commented 2 years ago

https://github.com/k-paxian/dart-json-mapper/blob/1acf9076e200409c76097386e94f615f2d046c0b/mapper/lib/src/model/converters.dart#L10-L11

Currently SerializeObjectFunction does not accept Null as object param, which affects _serializeObject of defaultIterableConverter when any element is null.

Should be able to workaround by changing the signature to

typedef SerializeObjectFunction = dynamic Function(Object? object, SerializationContext context);

but I am not sure if it has any side-effect.

k-paxian commented 2 years ago

Delivered, thank you for reporting!