-
Notifications
You must be signed in to change notification settings - Fork 418
Many fixes #14
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
Many fixes #14
Conversation
* Add `/* unsafe */` comments to generated output likely to be unsafe. * Support (de)serializing values in `Map`. * Fix ordering of fields when they are initialized via constructor. Fixes #11
Follow-on from #13 |
// Then we need to add `?.toList() | ||
expression += "?.toList()"; | ||
if (!isList) { | ||
// Then we need to add `?.toList() |
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.
avoid comments that only repeat what the code is doing - if you want to keep a comment here it should say why we need 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.
ack
} | ||
|
||
return expression; | ||
return "$expression /* unsafe */"; |
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.
This went from 46 lines to 80 lines - consider breaking out some composed methods
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.
ack
var subFieldValue = | ||
_fieldToJsonMapValue(substitute, valueType, depth + 1); | ||
|
||
// In this case, we're going to create a new Map with matching reified |
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.
more comments that only say what is happening...
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.
ack
expression += "?.toList()"; | ||
} | ||
|
||
return expression; |
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.
there are lots of early returns in this method - it's a little hard to keep track
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.
Yeah – can look at in a future PR. Added a note.
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.
...or just refactor!
keyArg.isObject || | ||
_coreStringChecker.isExactlyType(keyArg); | ||
|
||
var safeValue = false; |
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.
[optional] more declarative is safeValue = valueType.isDynamic || valueType.isObject || _stringBoolNumChecker.isAssignableFromType(valueType);
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.
Nice!
|
||
// convert | ||
|
||
var substitute = "v$depth"; |
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.
[nit] mixing single and double quotes in this file.
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.
Waiting for dart-archive/linter@aae769b
Added a TODO around prefer_single_quotes
@natebosch PTAL |
No description provided.