-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't custom JsonConverter with constructor arguments. Error "Generators with constructor arguments are not supported" #1373
Comments
Support Issue: Can't custom JsonConverter with constructor arguments google#1373
Issue: Can't custom JsonConverter with constructor arguments [google#1373]
@phuongvt Thanks for this awesome PR. |
@faisalansari0367 : Thank you for your support! First of all, sorry for the late reply.
so I still find "Generators with constructor arguments" necessary. I need MR as soon as possible to support my projects Thank you! |
Have you considered adding named constructors with the values pre-populated? That should work. |
@kevmoo yes, I was considering creating 'named constructors' that are often reused. However, I still think supporting 'Generators with constructor arguments' is necessary |
This will add non-trivial complexity to this package, sadly. |
i believe I have found a convenient enough workaround. in your Converter: const DecimalIntConverter.tenths() : this(places: -1);
const DecimalIntConverter({this.places = 0, this.base = 10}); in your type: @DecimalIntConverter.tenths() double someValue; |
This works fine for me |
When I write DateTimeConverter extends from JsonConverter with constructor arguments. Then use
run build_runner build
print error "Generators with constructor arguments are not supported"The text was updated successfully, but these errors were encountered: