Closed DevThibautMonin closed 3 months ago
You need to call
MyFirstDtoMapper.ensureInitialized();
MySecondDto.ensureInitialized();
before doing any decoding.
Ok, I tried and it seems to work, but I didn't see anything written in the documentation about this, I think.
Do I also need to call the ensureInitialize() method for all the other classes in general or only when I encounter this error?
EDIT : Ok, I finally found the part where it was written, my bad.
Thanks for help !
Only when using generic type params (<SomeClass>
)
Hello,
I'm encountering a problem when using the dart_mappable package to deserialize JSON into my objects.
The API im using returns different types of lists with the same structure (a message and a list of another object containing a list). I'm trying to pass the data type of the JSON objects as a generic type parameter. However, it seems like this type cannot be resolved.
Is this behavior normal and due to me using dart_mappable incorrectly, or is this unexpected?
Thank you in advance for your help.
Here are the classes I'm using. Depending on the API endpoint I need, I'll switch between different DTOs to retrieve the correct data.
No matter which DTO I use as the generic type, I always get this error, as if dart_mappable is unable to resolve the generic type.
MapperException: Failed to decode (MyClassA).request(List<MyClassB>): Unknown type List<MyClassB>. Did you forgot to annotate the class or register a custom mapper?
Thank's for help !