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.
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.
| } | ||
|
|
||
| return expression; | ||
| return "$expression /* unsafe */"; |
There was a problem hiding this comment.
This went from 46 lines to 80 lines - consider breaking out some composed methods
| 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.
more comments that only say what is happening...
| expression += "?.toList()"; | ||
| } | ||
|
|
||
| return expression; |
There was a problem hiding this comment.
there are lots of early returns in this method - it's a little hard to keep track
There was a problem hiding this comment.
Yeah – can look at in a future PR. Added a note.
There was a problem hiding this comment.
...or just refactor!
| keyArg.isObject || | ||
| _coreStringChecker.isExactlyType(keyArg); | ||
|
|
||
| var safeValue = false; |
There was a problem hiding this comment.
[optional] more declarative is safeValue = valueType.isDynamic || valueType.isObject || _stringBoolNumChecker.isAssignableFromType(valueType);
|
|
||
| // convert | ||
|
|
||
| var substitute = "v$depth"; |
There was a problem hiding this comment.
[nit] mixing single and double quotes in this file.
There was a problem hiding this comment.
Waiting for dart-archive/linter@aae769b
Added a TODO around prefer_single_quotes
|
@natebosch PTAL |
No description provided.