google / google/json_serializable.dart
Allow default value encoded as JSON or as the default constructor
Open
- Dominant language
- Dart
- Stars
- 1.6k
- Forks
- 461
- Avg merge
- 45m
- Merged PRs (30d)
- 1
Description
Consider this :
```
class InnerClass {
int field = 0;
int otherField = 0;
}
class OuterClass {
InnerClass innerClass = InnerClass();
// other fields
}
```
I can't set a default value for `innerClass`. I can edit the generated file of course, but that's annoying.
Dart semantics don't allow non-const values in annotations from my understanding, so a specific annotation field such as `includeFromJson` would be required.
Contributor guide
Assessment
This issue has not been assessed yet.