-
Notifications
You must be signed in to change notification settings - Fork 413
why not generate fromJson and toJson functions in the *.g.dart file? #647
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
Comments
You might want to pass in another parameter when you are creating from json i.e
|
We cannot do this until the language supports something like partial classes - dart-lang/language#252 |
I have the same problem with you. Mostly the default fromJson toJson are working fine. If I should have a different toJson (like fooToJson) I can just name a new method, why not? But now, I have to write the same code just as the generated code (fromJson/toJson) every time, and it's boring while I'm using the live template. |
Oh I assumed that's what the "part" was doing. |
So I'm using your library and the files are generating just fine.
I'm wondering though... I've got the following class:
All my models are going to have the same factory method and toJson methods. Would it not be better to just generate these in the .g.dart file?
The text was updated successfully, but these errors were encountered: