Skip to content

Commit e8bd3dc

Browse files
committed
Document JsonKey.extra
1 parent 75c9b24 commit e8bd3dc

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

json_annotation/lib/src/json_key.dart

+7
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ class JsonKey {
9090
/// Valid only on enum fields with a compatible enum value.
9191
final Object? unknownEnumValue;
9292

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

95102
/// Creates a new [JsonKey] instance.

json_serializable/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ is generated:
9494
| | | [JsonKey.required] |
9595
| | | [JsonKey.toJson] |
9696
| | | [JsonKey.unknownEnumValue] |
97+
| | | [JsonKey.extra] |
9798

9899
[JsonSerializable.anyMap]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/anyMap.html
99100
[JsonSerializable.checked]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/checked.html
@@ -114,6 +115,7 @@ is generated:
114115
[JsonKey.required]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/required.html
115116
[JsonKey.toJson]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/toJson.html
116117
[JsonKey.unknownEnumValue]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/unknownEnumValue.html
118+
[JsonKey.extra]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/extra.html
117119

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

0 commit comments

Comments
 (0)