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
feat: Add JsonSerializable(createJsonMeta) #1164
Conversation
1b692aa
to
e386254
Compare
/// | ||
/// This constant can be used by other code-generators to support features | ||
/// such as [fieldRename]. | ||
final bool? createJsonMeta; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"meta" is pretty vague here. Maybe createFieldMap
? Let's talk before you start rewriting everything...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xFieldMap sounds good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
assert(config.createJsonMeta); | ||
|
||
final buffer = | ||
StringBuffer('const _\$${element.name}JsonMeta = <String, String> {'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Careful using element.name
– if it's already private you'll end up with double _
which makes analyzer sad.
I have a helper around here somewhere for this"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I haven't seen another util for this
00036b9
to
5d00aad
Compare
still hacking on the failures @rrousselGit ? |
Indeed. I don't quite understand why the CI says generated code is outdated. It isn't for me locally |
@rrousselGit – need to do another rebuild. After a |
Looks like it's good now 😄 |
good job on this! |
As discussed before, this adds an option for generating a constant Map of
property name: json name
fixes #972