Skip to content

Commit

Permalink
Document JsonKey.extra
Browse files Browse the repository at this point in the history
  • Loading branch information
hacker1024 committed Jan 1, 2021
1 parent 75c9b24 commit eec918b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions json_annotation/lib/src/json_key.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ class JsonKey {
/// Valid only on enum fields with a compatible enum value.
final Object? unknownEnumValue;

/// `true` if this field should not be serialized.
///
/// Fields annotated with [extra] set to true will not be included in JSON
/// output, and their values may be passed in as additional arguments
/// alongside JSON data in the deserialization function.
///
/// If `null` (the default) or false, this argument has no effect.
final bool? extra;

/// Creates a new [JsonKey] instance.
Expand Down
2 changes: 2 additions & 0 deletions json_serializable/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ is generated:
| | | [JsonKey.required] |
| | | [JsonKey.toJson] |
| | | [JsonKey.unknownEnumValue] |
| | | [JsonKey.extra] |

[JsonSerializable.anyMap]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/anyMap.html
[JsonSerializable.checked]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/checked.html
Expand All @@ -114,6 +115,7 @@ is generated:
[JsonKey.required]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/required.html
[JsonKey.toJson]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/toJson.html
[JsonKey.unknownEnumValue]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/unknownEnumValue.html
[JsonKey.extra]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/extra.html

> Note: every `JsonSerializable` field is configurable via `build.yaml`
see the table for the corresponding key.
Expand Down

0 comments on commit eec918b

Please sign in to comment.