Closed DetachHead closed 2 years ago
Hm, there is a green unit test on that converter here
And it should be working out of the box, w/o adding any adapters.
Can you elaborate more on your use case?
hmm, it seems to work in that case, but not when attempting to serialize a List<Uint8List>
or an instance of the Uint8List
class itself (ie. not wrapped by anything):
void main() {
initializeJsonMapper(
adapters: [
JsonMapperAdapter(
valueDecorators: {
typeOf<List<Uint8List>>(): (final value) =>
(value as List).cast<Uint8List>(),
},
),
],
);
final foo = JsonMapper.serialize(Foo(Uint8List(100))); //works (same scenario as that test)
final bar = JsonMapper.serialize(Bar([Uint8List(100)])); //fails
final baz = JsonMapper.serialize(Uint8List(100)); //fails
}
Can you elaborate more on your use case?
i'm trying to store a list of images. maybe this isn't the best way to do that but it's what i've settled on for now
Well, you will be the first real user of that converter, that's good, since we could polish cases around that. Thanks for reaching out 😃
should be ok now both use cases you've had. With the version 2.2.3