Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions json_annotation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.0.0

- **BREAKING** Removed `JsonSerializable.useWrappers` and associated
`$`-prefixed helpers.

## 2.3.0

- Added `pascal` as an additional `fieldRename` option.
Expand Down
1 change: 0 additions & 1 deletion json_annotation/lib/json_annotation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ export 'src/json_key.dart';
export 'src/json_literal.dart';
export 'src/json_serializable.dart';
export 'src/json_value.dart';
export 'src/wrapper_helpers.dart';
12 changes: 1 addition & 11 deletions json_annotation/lib/src/json_serializable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,6 @@ class JsonSerializable {
/// `null` runtime validation if it's critical.
final bool nullable;

/// If `true`, wrappers are used to minimize the number of
/// [Map] and [List] instances created during serialization.
///
/// This will increase the code size, but it may improve runtime performance,
/// especially for large object graphs.
final bool useWrappers;

/// Creates a new [JsonSerializable] instance.
const JsonSerializable({
this.anyMap,
Expand All @@ -210,7 +203,6 @@ class JsonSerializable {
this.generateToJsonFunction,
this.includeIfNull,
this.nullable,
this.useWrappers,
});

factory JsonSerializable.fromJson(Map<String, dynamic> json) =>
Expand All @@ -230,7 +222,6 @@ class JsonSerializable {
generateToJsonFunction: true,
includeIfNull: true,
nullable: true,
useWrappers: false,
);

/// Returns a new [JsonSerializable] instance with fields equal to the
Expand All @@ -252,8 +243,7 @@ class JsonSerializable {
generateToJsonFunction:
generateToJsonFunction ?? defaults.generateToJsonFunction,
includeIfNull: includeIfNull ?? defaults.includeIfNull,
nullable: nullable ?? defaults.nullable,
useWrappers: useWrappers ?? defaults.useWrappers);
nullable: nullable ?? defaults.nullable);

Map<String, dynamic> toJson() => _$JsonSerializableToJson(this);
}
6 changes: 1 addition & 5 deletions json_annotation/lib/src/json_serializable.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 0 additions & 76 deletions json_annotation/lib/src/wrapper_helpers.dart

This file was deleted.

2 changes: 1 addition & 1 deletion json_annotation/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: json_annotation
version: 2.3.0
version: 3.0.0-dev
description: >-
Classes and helper functions that support JSON code generation via the
`json_serializable` package.
Expand Down
4 changes: 4 additions & 0 deletions json_serializable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0.0

- **BREAKING** Removed support for `JsonSerializable.useWrappers`.

## 2.3.0

- Added `pascal` as an additional `fieldRename` option.
Expand Down
45 changes: 21 additions & 24 deletions json_serializable/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ is generated:
| explicit_to_json | [JsonSerializable.explicitToJson] | |
| field_rename | [JsonSerializable.fieldRename] | |
| generate_to_json_function | [JsonSerializable.generateToJsonFunction] | |
| use_wrappers | [JsonSerializable.useWrappers] | |
| encode_empty_collection | [JsonSerializable.encodeEmptyCollection] | [JsonKey.encodeEmptyCollection] |
| include_if_null | [JsonSerializable.includeIfNull] | [JsonKey.includeIfNull] |
| nullable | [JsonSerializable.nullable] | [JsonKey.nullable] |
Expand All @@ -91,28 +90,27 @@ is generated:
| | | [JsonKey.required] |
| | | [JsonKey.toJson] |

[JsonSerializable.anyMap]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonSerializable/anyMap.html
[JsonSerializable.checked]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonSerializable/checked.html
[JsonSerializable.createFactory]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonSerializable/createFactory.html
[JsonSerializable.createToJson]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonSerializable/createToJson.html
[JsonSerializable.disallowUnrecognizedKeys]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonSerializable/disallowUnrecognizedKeys.html
[JsonSerializable.explicitToJson]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonSerializable/explicitToJson.html
[JsonSerializable.fieldRename]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonSerializable/fieldRename.html
[JsonSerializable.generateToJsonFunction]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonSerializable/generateToJsonFunction.html
[JsonSerializable.useWrappers]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonSerializable/useWrappers.html
[JsonSerializable.encodeEmptyCollection]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonSerializable/encodeEmptyCollection.html
[JsonKey.encodeEmptyCollection]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonKey/encodeEmptyCollection.html
[JsonSerializable.includeIfNull]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonSerializable/includeIfNull.html
[JsonKey.includeIfNull]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonKey/includeIfNull.html
[JsonSerializable.nullable]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonSerializable/nullable.html
[JsonKey.nullable]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonKey/nullable.html
[JsonKey.defaultValue]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonKey/defaultValue.html
[JsonKey.disallowNullValue]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonKey/disallowNullValue.html
[JsonKey.fromJson]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonKey/fromJson.html
[JsonKey.ignore]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonKey/ignore.html
[JsonKey.name]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonKey/name.html
[JsonKey.required]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonKey/required.html
[JsonKey.toJson]: https://pub.dev/documentation/json_annotation/2.3.0/json_annotation/JsonKey/toJson.html
[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
[JsonSerializable.createFactory]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/createFactory.html
[JsonSerializable.createToJson]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/createToJson.html
[JsonSerializable.disallowUnrecognizedKeys]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/disallowUnrecognizedKeys.html
[JsonSerializable.explicitToJson]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/explicitToJson.html
[JsonSerializable.fieldRename]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/fieldRename.html
[JsonSerializable.generateToJsonFunction]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/generateToJsonFunction.html
[JsonSerializable.encodeEmptyCollection]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/encodeEmptyCollection.html
[JsonKey.encodeEmptyCollection]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/encodeEmptyCollection.html
[JsonSerializable.includeIfNull]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/includeIfNull.html
[JsonKey.includeIfNull]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/includeIfNull.html
[JsonSerializable.nullable]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/nullable.html
[JsonKey.nullable]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/nullable.html
[JsonKey.defaultValue]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/defaultValue.html
[JsonKey.disallowNullValue]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/disallowNullValue.html
[JsonKey.fromJson]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/fromJson.html
[JsonKey.ignore]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/ignore.html
[JsonKey.name]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/name.html
[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

> Note: every `JsonSerializable` field is configurable via `build.yaml` –
see the table for the corresponding key.
Expand Down Expand Up @@ -151,7 +149,6 @@ targets:
generate_to_json_function: true
include_if_null: true
nullable: true
use_wrappers: false
```

[example]: https://github.com/dart-lang/json_serializable/blob/master/example
Expand Down
7 changes: 1 addition & 6 deletions json_serializable/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,14 @@ builders:
- .g_any_map__checked.dart
- .g_any_map__checked__non_nullable.dart
- .g_any_map__non_nullable.dart
- .g_any_map__non_nullable__use_wrappers.dart
- .g_exclude_null.dart
- .g_exclude_null__no_encode_empty.dart
- .g_exclude_null__no_encode_empty__non_nullable__use_wrappers.dart
- .g_exclude_null__no_encode_empty__use_wrappers.dart
- .g_exclude_null__no_encode_empty__non_nullable.dart
- .g_exclude_null__non_nullable.dart
- .g_exclude_null__use_wrappers.dart
- .g_explicit_to_json.dart
- .g_no_encode_empty.dart
- .g_no_encode_empty__non_nullable.dart
- .g_non_nullable.dart
- .g_non_nullable__use_wrappers.dart
- .g_use_wrappers.dart
build_to: source
runs_before: ["json_serializable"]

Expand Down
Loading