Skip to content

Upgrading json_serializable 5 to 6

Breaking5.0.2 → 6.15.2Breaking1Platform4New8Changed34Fixed20Other1

Fetching 48 releases from GitHub…23 / 48
BreakingUpgrade verdict

1 breaking change and 4 platform requirement changes.

  • The code generator now refuses to run on projects that use an older Dart language version than 3.0.
  • You must use Dart 3.8 or newer to use this version.
  • Require Dart 3.8.
  • You need Dart 3.6 or newer to use this version.
Top 4 of 5 that need code or config changes

Dart SDK requirement changed in 6.15.0: >=2.12.0 <3.0.0 → ^3.12.0.

Adds async ^2.10.0, dart_style ^3.1.4, pub_semver ^2.1.4, pubspec_parse ^1.0.0.

Drops collection.

Moves analyzer ^2.0.0 → >=10.0.0 <15.0.0, build ^2.0.0 → >=4.0.4 <6.0.0, build_config >=0.4.4 <2.0.0 → ^1.2.0, json_annotation >=4.1.0 <4.2.0 → >=4.12.0 <4.13.0, meta ^1.3.0 → ^1.16.0, path ^1.8.0 → ^1.9.0, source_gen ^1.0.0 → ^4.1.2, source_helper ^1.2.1 → ^1.3.10. Your build may pick other versions.

Breaking1
Errors out if the target package does not have a language version of 3.0 or greater.
Platform4
Requires Dart 3.8.
Require Dart 3.8.
Requires Dart 3.6.
Requires Dart 3.5.

Generated by DepDelta from published Dart source. Not mixed with prose notes.

  • added: class JsonEnumGenerator extends GeneratorForAnnotation<JsonEnum>
  • added: ctor JsonEnumGenerator()
  • added: method JsonEnumGenerator.generateForAnnotatedElement( Element element, ConstantReader annotation, BuildStep buildStep, ): List<String>
  • removed: field ClassConfig.ctorParamDefaults: final Map<String, String>
  • removed: field KeyConfig.ignore: final bool
  • removed: method ClassConfig.toJson(): Map<String, dynamic>
  • removed: method ClassConfig.withDefaults(): JsonSerializable
  • changed: class ClassConfig implements JsonSerializable → class ClassConfig
  • changed: class DateTimeHelper extends TypeHelper → class DateTimeHelper extends TypeHelper<TypeHelperContextWithConfig>
  • changed: class JsonConverterHelper extends TypeHelper → class JsonConverterHelper extends TypeHelper<TypeHelperContextWithConfig>
  • changed: ctor ClassConfig({ required this.anyMap, required this.checked, required this.createFactory, required this.createToJson, required this.disallowUnrecognizedKeys, required this.explicitToJson, required this.fieldRename, required this.genericArgumentFactories, required this.ignoreUnannotated, required this.includeIfNull, this.ctorParamDefaults = …, }) → ctor ClassConfig({ required this.anyMap, required this.checked, required this.constructor, required this.createFactory, required this.createToJson, required this.createFieldMap, required this.createJsonKeys, required this.createPerFieldToJson, required this.createJsonSchema, required this.dateTimeUtc, required this.disallowUnrecognizedKeys, required this.explicitToJson, required this.fieldRename,…
  • changed: ctor ConvertData(this.name, this.paramType) → ctor ConvertData(this.name, this.paramType, this.returnType)
  • changed: ctor JsonConverterHelper() → ctor JsonConverterHelper({this.forMapKey = …})
  • changed: ctor KeyConfig({ required this.defaultValue, required this.disallowNullValue, required this.ignore, required this.includeIfNull, required this.name, required this.required, required this.unknownEnumValue, }) → ctor KeyConfig({ required this.defaultValue, required this.disallowNullValue, required this.explicitJsonNullWhenNonNullField, required this.includeFromJson, required this.includeIfNull, required this.includeToJson, required this.name, required this.readValueFunctionName, required this.required, required this.unknownEnumValue, })
  • changed: field KeyConfig.unknownEnumValue: final Object? → field KeyConfig.unknownEnumValue: final String?
  • changed: method BigIntHelper.deserialize( DartType targetType, String expression, TypeHelperContext context, bool defaultProvided, ): String? → method BigIntHelper.deserialize( DartType targetType, String expression, TypeHelperContext context, bool defaultProvided, ): DefaultContainer?
  • changed: method DateTimeHelper.deserialize( DartType targetType, String expression, TypeHelperContext context, bool defaultProvided, ): String? → method DateTimeHelper.deserialize( DartType targetType, String expression, TypeHelperContext context, bool defaultProvided, ): DefaultContainer?
  • changed: method DateTimeHelper.serialize( DartType targetType, String expression, TypeHelperContext context, ): String? → method DateTimeHelper.serialize( DartType targetType, String expression, TypeHelperContextWithConfig context, ): String?
  • changed: method DurationHelper.deserialize( DartType targetType, String expression, TypeHelperContext context, bool defaultProvided, ): String? → method DurationHelper.deserialize( DartType targetType, String expression, TypeHelperContext context, bool defaultProvided, ): Object?
  • changed: method EnumHelper.deserialize( DartType targetType, String expression, TypeHelperContextWithConfig context, bool defaultProvided, ): String? → method EnumHelper.deserialize( DartType targetType, String expression, TypeHelperContextWithConfig context, bool defaultProvided, ): Object?
  • changed: method JsonConverterHelper.deserialize( DartType targetType, String expression, TypeHelperContext context, bool defaultProvided, ): Object? → method JsonConverterHelper.deserialize( DartType targetType, String expression, TypeHelperContextWithConfig context, bool defaultProvided, ): Object?
  • changed: method JsonConverterHelper.serialize( DartType targetType, String expression, TypeHelperContext context, ): Object? → method JsonConverterHelper.serialize( DartType targetType, String expression, TypeHelperContextWithConfig context, ): Object?
  • changed: method UriHelper.deserialize( DartType targetType, String expression, TypeHelperContext context, bool defaultProvided, ): String? → method UriHelper.deserialize( DartType targetType, String expression, TypeHelperContext context, bool defaultProvided, ): DefaultContainer?
  • added: ctor ClassConfig.fromJsonSerializable(JsonSerializable config)
  • added: field ClassConfig.constructor: final String
  • added: field ClassConfig.converters: final List<DartObject>
  • added: field ClassConfig.createFieldMap: final bool
  • added: field ClassConfig.createJsonKeys: final bool
  • added: field ClassConfig.createJsonSchema: final bool
  • added: field ClassConfig.createPerFieldToJson: final bool
  • added: field ClassConfig.ctorParams: final List<FormalParameterElement>
  • added: field ClassConfig.dateTimeUtc: final bool
  • added: field ConvertData.returnType: final DartType
  • added: field JsonConverterHelper.forMapKey: final bool
  • added: field KeyConfig.explicitJsonNullWhenNonNullField: final bool
  • added: field KeyConfig.includeFromJson: final bool?
  • added: field KeyConfig.includeToJson: final bool?
  • added: field KeyConfig.readValueFunctionName: final String?
  • added: function hasConverterNullEncode( DartType targetType, TypeHelperContextWithConfig ctx, { bool forNullCheck = …, }): bool?
  • added: get KeyConfig.explicitNoFromJson: bool
  • added: get KeyConfig.explicitNoToJson: bool
  • added: get KeyConfig.explicitYesFromJson: bool
  • added: get KeyConfig.explicitYesToJson: bool
  • added: method ClassConfig.copyWith({List<FormalParameterElement>? ctorParams}): ClassConfig
  • added: method ClassConfig.toJsonSerializable(): JsonSerializable