shamblett / cbor

A CBOR implementation for Dart
MIT License
36 stars 16 forks source link

Allow to define Map type while decoding #59

Open muzzammilshahid opened 5 months ago

muzzammilshahid commented 5 months ago

The Cbor serializer currently can't specify the types of keys and values for a Map during decoding. It would be beneficial to introduce a feature like:

CborSimpleCodec cborSimpleCodec = CborSimpleCodec(mapType: Type);

For reference, something like https://github.com/ugorji/go/blob/07c54c229a5acac2d5bc739820a3ecc5411b7b33/codec/decode.go#L216

shamblett commented 5 months ago

Maybe, I need to look further, need to be careful of outputting as json as json only has map key types as string of course.