Closed rgjurgens closed 1 year ago
Thanks! Yes, I isolated the issue in a clean project. It seems that indeed using named variables with required
prefix was giving issues. btw I sponsored you for your awesome work.
Thank you so much 🙏 Feel free to challenge me anytime
Well, I have one more question, but I'm not sure this is the right place to put it: sometimes, I find it hard to debug why parsing went wrong in your framework. For instance, when a JSON field is missing. Is it easy to add to the logging on what parsing failed exactly? Now we only get:
flutter: type 'Null' is not a subtype of type 'String'
Surely we could enhance the error handling, we need to define the use cases first. If you could illustrate the example, when it happens. Does it relates to the omitted constructor parameters only?
No, it happens for instance in this case:
@jsonSerializable
class Person {
final String name;
final int age;
}
and the JSON trying to parse is this:
{
"name":15
}
Where age is missing.
However when using your framework in a standalone project however, I see a breakpoint happening at the exact right place in mapper.g.dart
. But this is not happening in my main project and I think because the code is in a try catch
block.
Ok, let's make an improvement then. I'll try to make it better and will be back to you for a feedback 🙂
So far, it seems to work nicely!!! Thanks a lot! I'll come with more feedback later 🙏
Hi, I'm using version
^2.2.6+1
and while parsing the exact same thing works fine for iOS and Android, it doesn't work fine on web. I couldn't find the exact issue, but the library fails on:Expected a value of type 'String', but got one of type 'Null'
, on exactly this code block:in the JSON fed to the library, none of the values are actually
null
, so I wonder what the error message comes from? Is this a known issue?Thanks for the help!!!