From e0c7325238dc0e831fd94d809bc5e2fb50d8e73a Mon Sep 17 00:00:00 2001 From: Vasiliy Ditsyak Date: Fri, 28 Aug 2026 17:06:29 +0200 Subject: [PATCH 1/2] analyzer 13 support, bump to 8.6.0 --- .vscode/settings.json | 3 + packages/generator_tests/pubspec.yaml | 6 +- .../reactive_forms_annotations/CHANGELOG.md | 4 + .../reactive_forms_annotations/pubspec.yaml | 2 +- .../reactive_forms_generator/CHANGELOG.md | 5 + .../docs/create/create_output.freezed.dart | 23 +-- .../docs/freezed/freezed_class.freezed.dart | 9 +- .../freezed/freezed_class_output.freezed.dart | 19 +-- .../lib/docs/freezed2/test.freezed.dart | 5 +- .../lib/docs/generic/generic.freezed.dart | 7 +- .../docs/generic/generic_output.freezed.dart | 11 +- .../lib/docs/nested/nested.freezed.dart | 13 +- .../docs/nested/nested_output.freezed.dart | 23 +-- .../nested_generics.freezed.dart | 11 +- .../nested_generics_output.freezed.dart | 15 +- .../lib/docs/profile/profile.freezed.dart | 21 +-- .../docs/profile/profile_output.freezed.dart | 31 ++-- .../lib/docs/recursive/recursive.freezed.dart | 11 +- .../example/pubspec.yaml | 2 +- .../lib/src/output/extensions.dart | 141 +++++++----------- .../lib/src/output/helpers.dart | 38 ++--- .../src/output/rf_annotation_arguments.dart | 14 +- .../rf_annotation_arguments_visitor.dart | 8 +- .../lib/src/output/rf_paramater_visitor.dart | 20 +-- .../lib/src/types.dart | 6 +- .../reactive_forms_generator/pubspec.yaml | 6 +- pubspec.lock | 40 +++-- pubspec.yaml | 6 + 28 files changed, 253 insertions(+), 247 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..77a35a3c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "dart.flutterSdkPath": "~/fvm/default" +} \ No newline at end of file diff --git a/packages/generator_tests/pubspec.yaml b/packages/generator_tests/pubspec.yaml index e0fb05ae..f5e9f19e 100644 --- a/packages/generator_tests/pubspec.yaml +++ b/packages/generator_tests/pubspec.yaml @@ -28,7 +28,7 @@ dependencies: path: ^1.8.2 build_runner: ^2.10.1 code_builder: ^4.11.0 - dart_style: ">=3.1.8 <3.1.9" + dart_style: ">=3.1.9 <3.1.10" recase: ^4.1.0 reactive_forms_annotations: path: ../reactive_forms_annotations @@ -37,8 +37,8 @@ dependencies: dev_dependencies: json_serializable: build_test: ^3.4.1 - freezed: 3.2.6-dev.1 - test: ^1.25.15 + freezed: 4.0.0-dev.3 + test: 1.31.1 logging: ^1.3.0 reactive_forms_generator: path: ../reactive_forms_generator diff --git a/packages/reactive_forms_annotations/CHANGELOG.md b/packages/reactive_forms_annotations/CHANGELOG.md index c3db1229..4de4b830 100644 --- a/packages/reactive_forms_annotations/CHANGELOG.md +++ b/packages/reactive_forms_annotations/CHANGELOG.md @@ -1,3 +1,7 @@ +## [8.6.0] + +* analyzer 13 compatibility + ## [8.5.0] * analyzer 12 compatibility diff --git a/packages/reactive_forms_annotations/pubspec.yaml b/packages/reactive_forms_annotations/pubspec.yaml index a53a6215..e12d6615 100644 --- a/packages/reactive_forms_annotations/pubspec.yaml +++ b/packages/reactive_forms_annotations/pubspec.yaml @@ -2,7 +2,7 @@ name: reactive_forms_annotations description: Annotations for reactive_forms_generator repository: https://github.com/artflutter/reactive_forms_generator -version: 8.5.0 +version: 8.6.0 environment: sdk: ">=3.8.0 <4.0.0" diff --git a/packages/reactive_forms_generator/CHANGELOG.md b/packages/reactive_forms_generator/CHANGELOG.md index 7a198534..b29bde7f 100644 --- a/packages/reactive_forms_generator/CHANGELOG.md +++ b/packages/reactive_forms_generator/CHANGELOG.md @@ -1,3 +1,8 @@ +## [8.6.0] + +* analyzer 13 compatibility +* migrate to analyzer 13 unified formal parameter AST + ## [8.5.0] * analyzer 12 compatibility diff --git a/packages/reactive_forms_generator/example/lib/docs/create/create_output.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/create/create_output.freezed.dart index 57ea2304..9d7948a0 100644 --- a/packages/reactive_forms_generator/example/lib/docs/create/create_output.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/create/create_output.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'create_output.dart'; @@ -9,6 +9,7 @@ part of 'create_output.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; /// @nodoc @@ -63,7 +64,7 @@ class _$MSICreateCopyWithImpl<$Res> /// Create a copy of MSICreate /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? businessNumber = freezed,Object? fileIds = freezed,Object? name = freezed,Object? companyAddress = null,Object? email = freezed,Object? primaryContact = null,Object? sameMailingAddressAsCompany = null,Object? mailingAddress = null,Object? admins = null,}) { - return _then(_self.copyWith( + return _then(MSICreate( id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String?,businessNumber: freezed == businessNumber ? _self.businessNumber : businessNumber // ignore: cast_nullable_to_non_nullable as String?,fileIds: freezed == fileIds ? _self.fileIds : fileIds // ignore: cast_nullable_to_non_nullable @@ -242,7 +243,7 @@ return $default(_that.id,_that.businessNumber,_that.fileIds,_that.name,_that.com class _MSICreate implements MSICreate { - const _MSICreate({this.id, this.businessNumber, final List? fileIds, @RfControl(validators: [RequiredValidator(), MaxLengthValidator(120)]) this.name, this.companyAddress = const Address(), @RfControl(validators: [RequiredValidator(), EmailValidator()]) this.email, this.primaryContact = const PrimaryContact(), @RfControl() this.sameMailingAddressAsCompany = false, this.mailingAddress = const Address(), @RfArray() final List admins = const [AdminContactInformation()]}): _fileIds = fileIds,_admins = admins; + const _MSICreate({this.id, this.businessNumber, List? fileIds, @RfControl(validators: [RequiredValidator(), MaxLengthValidator(120)]) this.name, this.companyAddress = const Address(), @RfControl(validators: [RequiredValidator(), EmailValidator()]) this.email, this.primaryContact = const PrimaryContact(), @RfControl() this.sameMailingAddressAsCompany = false, this.mailingAddress = const Address(), @RfArray() List admins = const [AdminContactInformation()]}): _fileIds = fileIds,_admins = admins; @override final String? id; @@ -415,7 +416,7 @@ class _$AddressCopyWithImpl<$Res> /// Create a copy of Address /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? street = freezed,Object? city = freezed,Object? stateOrProvince = freezed,Object? zipCode = freezed,}) { - return _then(_self.copyWith( + return _then(Address( street: freezed == street ? _self.street : street // ignore: cast_nullable_to_non_nullable as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable as String?,stateOrProvince: freezed == stateOrProvince ? _self.stateOrProvince : stateOrProvince // ignore: cast_nullable_to_non_nullable @@ -681,7 +682,7 @@ class _$PrimaryContactCopyWithImpl<$Res> /// Create a copy of PrimaryContact /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? fullName = freezed,Object? jobTitle = freezed,Object? email = freezed,}) { - return _then(_self.copyWith( + return _then(PrimaryContact( fullName: freezed == fullName ? _self.fullName : fullName // ignore: cast_nullable_to_non_nullable as String?,jobTitle: freezed == jobTitle ? _self.jobTitle : jobTitle // ignore: cast_nullable_to_non_nullable as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable @@ -944,7 +945,7 @@ class _$AdminContactInformationCopyWithImpl<$Res> /// Create a copy of AdminContactInformation /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? firstName = freezed,Object? lastName = freezed,Object? email = freezed,}) { - return _then(_self.copyWith( + return _then(AdminContactInformation( firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable @@ -1207,7 +1208,7 @@ class _$MSICreateOutputCopyWithImpl<$Res> /// Create a copy of MSICreateOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? businessNumber = freezed,Object? fileIds = freezed,Object? name = null,Object? companyAddress = null,Object? email = null,Object? primaryContact = null,Object? sameMailingAddressAsCompany = null,Object? mailingAddress = null,Object? admins = null,}) { - return _then(_self.copyWith( + return _then(MSICreateOutput( id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String?,businessNumber: freezed == businessNumber ? _self.businessNumber : businessNumber // ignore: cast_nullable_to_non_nullable as String?,fileIds: freezed == fileIds ? _self.fileIds : fileIds // ignore: cast_nullable_to_non_nullable @@ -1386,7 +1387,7 @@ return $default(_that.id,_that.businessNumber,_that.fileIds,_that.name,_that.com class _MSICreateOutput implements MSICreateOutput { - const _MSICreateOutput({this.id, this.businessNumber, final List? fileIds, @RfControl(validators: [RequiredValidator(), MaxLengthValidator(120)]) required this.name, required this.companyAddress, @RfControl(validators: [RequiredValidator(), EmailValidator()]) required this.email, required this.primaryContact, @RfControl() this.sameMailingAddressAsCompany = false, required this.mailingAddress, @RfArray() required final List admins}): _fileIds = fileIds,_admins = admins; + const _MSICreateOutput({this.id, this.businessNumber, List? fileIds, @RfControl(validators: [RequiredValidator(), MaxLengthValidator(120)]) required this.name, required this.companyAddress, @RfControl(validators: [RequiredValidator(), EmailValidator()]) required this.email, required this.primaryContact, @RfControl() this.sameMailingAddressAsCompany = false, required this.mailingAddress, @RfArray() required List admins}): _fileIds = fileIds,_admins = admins; @override final String? id; @@ -1559,7 +1560,7 @@ class _$AddressOutputCopyWithImpl<$Res> /// Create a copy of AddressOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? street = null,Object? city = null,Object? stateOrProvince = null,Object? zipCode = null,}) { - return _then(_self.copyWith( + return _then(AddressOutput( street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable as String,stateOrProvince: null == stateOrProvince ? _self.stateOrProvince : stateOrProvince // ignore: cast_nullable_to_non_nullable @@ -1825,7 +1826,7 @@ class _$PrimaryContactOutputCopyWithImpl<$Res> /// Create a copy of PrimaryContactOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? fullName = null,Object? jobTitle = freezed,Object? email = null,}) { - return _then(_self.copyWith( + return _then(PrimaryContactOutput( fullName: null == fullName ? _self.fullName : fullName // ignore: cast_nullable_to_non_nullable as String,jobTitle: freezed == jobTitle ? _self.jobTitle : jobTitle // ignore: cast_nullable_to_non_nullable as String?,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable @@ -2088,7 +2089,7 @@ class _$AdminContactInformationOutputCopyWithImpl<$Res> /// Create a copy of AdminContactInformationOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? firstName = null,Object? lastName = null,Object? email = null,}) { - return _then(_self.copyWith( + return _then(AdminContactInformationOutput( firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable diff --git a/packages/reactive_forms_generator/example/lib/docs/freezed/freezed_class.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/freezed/freezed_class.freezed.dart index 2d88b3a8..367eead7 100644 --- a/packages/reactive_forms_generator/example/lib/docs/freezed/freezed_class.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/freezed/freezed_class.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'freezed_class.dart'; @@ -9,6 +9,7 @@ part of 'freezed_class.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; @@ -66,8 +67,8 @@ class _$FreezedClassCopyWithImpl<$Res> /// Create a copy of FreezedClass /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? gender = freezed,Object? id = freezed,Object? name = freezed,Object? logoImage = freezed,Object? year = freezed,Object? selectedSpaces = null,}) { - return _then(_self.copyWith( -gender: freezed == gender ? _self.gender : gender // ignore: cast_nullable_to_non_nullable + return _then(FreezedClass( +freezed == gender ? _self.gender : gender // ignore: cast_nullable_to_non_nullable as String?,id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String?,logoImage: freezed == logoImage ? _self.logoImage : logoImage // ignore: cast_nullable_to_non_nullable @@ -214,7 +215,7 @@ return $default(_that.gender,_that.id,_that.name,_that.logoImage,_that.year,_tha @JsonSerializable() class _FreezedClass extends FreezedClass { - _FreezedClass(@RfControl() this.gender, {@RfControl(validators: [RequiredValidator()]) this.id, @RfControl() this.name, @JsonKey(name: 'logo_image')@RfControl() this.logoImage, @RfControl() this.year, final List selectedSpaces = const []}): _selectedSpaces = selectedSpaces,super._(); + _FreezedClass(@RfControl() this.gender, {@RfControl(validators: [RequiredValidator()]) this.id, @RfControl() this.name, @JsonKey(name: 'logo_image')@RfControl() this.logoImage, @RfControl() this.year, List selectedSpaces = const []}): _selectedSpaces = selectedSpaces,super._(); factory _FreezedClass.fromJson(Map json) => _$FreezedClassFromJson(json); @override@RfControl() final String? gender; diff --git a/packages/reactive_forms_generator/example/lib/docs/freezed/freezed_class_output.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/freezed/freezed_class_output.freezed.dart index 456de4b6..11c69361 100644 --- a/packages/reactive_forms_generator/example/lib/docs/freezed/freezed_class_output.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/freezed/freezed_class_output.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'freezed_class_output.dart'; @@ -9,6 +9,7 @@ part of 'freezed_class_output.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; @@ -66,9 +67,9 @@ class _$FreezedClassOCopyWithImpl<$Res> /// Create a copy of FreezedClassO /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? gender = freezed,Object? genderR = freezed,Object? id = freezed,Object? idR = freezed,Object? idR2 = null,Object? name = freezed,Object? logoImage = freezed,Object? year = freezed,Object? selectedSpaces = null,}) { - return _then(_self.copyWith( -gender: freezed == gender ? _self.gender : gender // ignore: cast_nullable_to_non_nullable -as String?,genderR: freezed == genderR ? _self.genderR : genderR // ignore: cast_nullable_to_non_nullable + return _then(FreezedClassO( +freezed == gender ? _self.gender : gender // ignore: cast_nullable_to_non_nullable +as String?,freezed == genderR ? _self.genderR : genderR // ignore: cast_nullable_to_non_nullable as String?,id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String?,idR: freezed == idR ? _self.idR : idR // ignore: cast_nullable_to_non_nullable as String?,idR2: null == idR2 ? _self.idR2 : idR2 // ignore: cast_nullable_to_non_nullable @@ -217,7 +218,7 @@ return $default(_that.gender,_that.genderR,_that.id,_that.idR,_that.idR2,_that.n @JsonSerializable() class _FreezedClassO extends FreezedClassO { - _FreezedClassO(@RfControl() this.gender, @RfControl(validators: [RequiredValidator()]) this.genderR, {@RfControl() this.id, @RfControl(validators: [RequiredValidator()]) this.idR, @RfControl(validators: [RequiredValidator()]) this.idR2 = '', @RfControl() this.name, @JsonKey(name: 'logo_image')@RfControl() this.logoImage, @RfControl() this.year, final List selectedSpaces = const []}): _selectedSpaces = selectedSpaces,super._(); + _FreezedClassO(@RfControl() this.gender, @RfControl(validators: [RequiredValidator()]) this.genderR, {@RfControl() this.id, @RfControl(validators: [RequiredValidator()]) this.idR, @RfControl(validators: [RequiredValidator()]) this.idR2 = '', @RfControl() this.name, @JsonKey(name: 'logo_image')@RfControl() this.logoImage, @RfControl() this.year, List selectedSpaces = const []}): _selectedSpaces = selectedSpaces,super._(); factory _FreezedClassO.fromJson(Map json) => _$FreezedClassOFromJson(json); @override@RfControl() final String? gender; @@ -359,9 +360,9 @@ class _$FreezedClassOOutputCopyWithImpl<$Res> /// Create a copy of FreezedClassOOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? gender = freezed,Object? genderR = null,Object? id = freezed,Object? idR = null,Object? idR2 = null,Object? name = freezed,Object? logoImage = freezed,Object? year = freezed,Object? selectedSpaces = null,}) { - return _then(_self.copyWith( -gender: freezed == gender ? _self.gender : gender // ignore: cast_nullable_to_non_nullable -as String?,genderR: null == genderR ? _self.genderR : genderR // ignore: cast_nullable_to_non_nullable + return _then(FreezedClassOOutput( +freezed == gender ? _self.gender : gender // ignore: cast_nullable_to_non_nullable +as String?,null == genderR ? _self.genderR : genderR // ignore: cast_nullable_to_non_nullable as String,id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String?,idR: null == idR ? _self.idR : idR // ignore: cast_nullable_to_non_nullable as String,idR2: null == idR2 ? _self.idR2 : idR2 // ignore: cast_nullable_to_non_nullable @@ -510,7 +511,7 @@ return $default(_that.gender,_that.genderR,_that.id,_that.idR,_that.idR2,_that.n @JsonSerializable() class _FreezedClassOOutput extends FreezedClassOOutput { - _FreezedClassOOutput(@RfControl() this.gender, @RfControl(validators: [RequiredValidator()]) this.genderR, {@RfControl() this.id, @RfControl(validators: [RequiredValidator()]) required this.idR, @RfControl(validators: [RequiredValidator()]) required this.idR2, @RfControl() this.name, @JsonKey(name: 'logo_image')@RfControl() this.logoImage, @RfControl() this.year, final List selectedSpaces = const []}): _selectedSpaces = selectedSpaces,super._(); + _FreezedClassOOutput(@RfControl() this.gender, @RfControl(validators: [RequiredValidator()]) this.genderR, {@RfControl() this.id, @RfControl(validators: [RequiredValidator()]) required this.idR, @RfControl(validators: [RequiredValidator()]) required this.idR2, @RfControl() this.name, @JsonKey(name: 'logo_image')@RfControl() this.logoImage, @RfControl() this.year, List selectedSpaces = const []}): _selectedSpaces = selectedSpaces,super._(); factory _FreezedClassOOutput.fromJson(Map json) => _$FreezedClassOOutputFromJson(json); @override@RfControl() final String? gender; diff --git a/packages/reactive_forms_generator/example/lib/docs/freezed2/test.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/freezed2/test.freezed.dart index dafcf0b3..35335f6c 100644 --- a/packages/reactive_forms_generator/example/lib/docs/freezed2/test.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/freezed2/test.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'test.dart'; @@ -9,6 +9,7 @@ part of 'test.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; /// @nodoc @@ -63,7 +64,7 @@ class _$TestCopyWithImpl<$Res> /// Create a copy of Test /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? title = null,Object? description = freezed,}) { - return _then(_self.copyWith( + return _then(Test( title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String?, diff --git a/packages/reactive_forms_generator/example/lib/docs/generic/generic.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/generic/generic.freezed.dart index 82558fb9..4c400924 100644 --- a/packages/reactive_forms_generator/example/lib/docs/generic/generic.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/generic/generic.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'generic.dart'; @@ -9,6 +9,7 @@ part of 'generic.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; /// @nodoc @@ -63,7 +64,7 @@ class _$TagsCopyWithImpl /// Create a copy of Tags /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? tags = freezed,}) { - return _then(_self.copyWith( + return _then(Tags( tags: freezed == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable as List?, )); @@ -206,7 +207,7 @@ return $default(_that.tags);case _: class _Tags extends Tags { - _Tags({@RfControl() required final List? tags}): _tags = tags,super._(); + _Tags({@RfControl() required List? tags}): _tags = tags,super._(); final List? _tags; diff --git a/packages/reactive_forms_generator/example/lib/docs/generic/generic_output.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/generic/generic_output.freezed.dart index c5a49578..6a640de0 100644 --- a/packages/reactive_forms_generator/example/lib/docs/generic/generic_output.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/generic/generic_output.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'generic_output.dart'; @@ -9,6 +9,7 @@ part of 'generic_output.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; /// @nodoc @@ -63,7 +64,7 @@ class _$TagsOCopyWithImpl /// Create a copy of TagsO /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? tags = freezed,}) { - return _then(_self.copyWith( + return _then(TagsO( tags: freezed == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable as List?, )); @@ -206,7 +207,7 @@ return $default(_that.tags);case _: class _TagsO extends TagsO { - _TagsO({@RfControl() required final List? tags}): _tags = tags,super._(); + _TagsO({@RfControl() required List? tags}): _tags = tags,super._(); final List? _tags; @@ -328,7 +329,7 @@ class _$TagsOOutputCopyWithImpl /// Create a copy of TagsOOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? tags = freezed,}) { - return _then(_self.copyWith( + return _then(TagsOOutput( tags: freezed == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable as List?, )); @@ -471,7 +472,7 @@ return $default(_that.tags);case _: class _TagsOOutput extends TagsOOutput { - _TagsOOutput({@RfControl() required final List? tags}): _tags = tags,super._(); + _TagsOOutput({@RfControl() required List? tags}): _tags = tags,super._(); final List? _tags; diff --git a/packages/reactive_forms_generator/example/lib/docs/nested/nested.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/nested/nested.freezed.dart index a60778e1..57cb1f91 100644 --- a/packages/reactive_forms_generator/example/lib/docs/nested/nested.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/nested/nested.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'nested.dart'; @@ -9,6 +9,7 @@ part of 'nested.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; @@ -66,7 +67,7 @@ class _$SubGroupCopyWithImpl<$Res> /// Create a copy of SubGroup /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = null,}) { - return _then(_self.copyWith( + return _then(SubGroup( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String, )); @@ -329,7 +330,7 @@ class _$GroupCopyWithImpl<$Res> /// Create a copy of Group /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? subGroupList = null,}) { - return _then(_self.copyWith( + return _then(Group( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,subGroupList: null == subGroupList ? _self.subGroupList : subGroupList // ignore: cast_nullable_to_non_nullable as List, @@ -473,7 +474,7 @@ return $default(_that.id,_that.subGroupList);case _: @JsonSerializable() class _Group implements Group { - const _Group({@RfControl() required this.id, @RfArray() required final List subGroupList}): _subGroupList = subGroupList; + const _Group({@RfControl() required this.id, @RfArray() required List subGroupList}): _subGroupList = subGroupList; factory _Group.fromJson(Map json) => _$GroupFromJson(json); @override@RfControl() final String id; @@ -601,7 +602,7 @@ class _$NestedCopyWithImpl<$Res> /// Create a copy of Nested /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? groupList = null,}) { - return _then(_self.copyWith( + return _then(Nested( groupList: null == groupList ? _self.groupList : groupList // ignore: cast_nullable_to_non_nullable as List, )); @@ -744,7 +745,7 @@ return $default(_that.groupList);case _: @JsonSerializable() class _Nested implements Nested { - const _Nested({@RfArray() required final List groupList}): _groupList = groupList; + const _Nested({@RfArray() required List groupList}): _groupList = groupList; factory _Nested.fromJson(Map json) => _$NestedFromJson(json); final List _groupList; diff --git a/packages/reactive_forms_generator/example/lib/docs/nested/nested_output.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/nested/nested_output.freezed.dart index 53251e0e..3ba6c6d8 100644 --- a/packages/reactive_forms_generator/example/lib/docs/nested/nested_output.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/nested/nested_output.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'nested_output.dart'; @@ -9,6 +9,7 @@ part of 'nested_output.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; @@ -66,7 +67,7 @@ class _$SubGroupOCopyWithImpl<$Res> /// Create a copy of SubGroupO /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = null,}) { - return _then(_self.copyWith( + return _then(SubGroupO( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String, )); @@ -329,7 +330,7 @@ class _$GroupOCopyWithImpl<$Res> /// Create a copy of GroupO /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? subGroupList = null,}) { - return _then(_self.copyWith( + return _then(GroupO( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,subGroupList: null == subGroupList ? _self.subGroupList : subGroupList // ignore: cast_nullable_to_non_nullable as List, @@ -473,7 +474,7 @@ return $default(_that.id,_that.subGroupList);case _: @JsonSerializable() class _GroupO implements GroupO { - const _GroupO({@RfControl() required this.id, @RfArray() required final List subGroupList}): _subGroupList = subGroupList; + const _GroupO({@RfControl() required this.id, @RfArray() required List subGroupList}): _subGroupList = subGroupList; factory _GroupO.fromJson(Map json) => _$GroupOFromJson(json); @override@RfControl() final String id; @@ -601,7 +602,7 @@ class _$NestedOCopyWithImpl<$Res> /// Create a copy of NestedO /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? groupList = null,}) { - return _then(_self.copyWith( + return _then(NestedO( groupList: null == groupList ? _self.groupList : groupList // ignore: cast_nullable_to_non_nullable as List, )); @@ -744,7 +745,7 @@ return $default(_that.groupList);case _: @JsonSerializable() class _NestedO implements NestedO { - const _NestedO({@RfArray() required final List groupList}): _groupList = groupList; + const _NestedO({@RfArray() required List groupList}): _groupList = groupList; factory _NestedO.fromJson(Map json) => _$NestedOFromJson(json); final List _groupList; @@ -870,7 +871,7 @@ class _$SubGroupOOutputCopyWithImpl<$Res> /// Create a copy of SubGroupOOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = null,}) { - return _then(_self.copyWith( + return _then(SubGroupOOutput( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String, )); @@ -1133,7 +1134,7 @@ class _$GroupOOutputCopyWithImpl<$Res> /// Create a copy of GroupOOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? subGroupList = null,}) { - return _then(_self.copyWith( + return _then(GroupOOutput( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,subGroupList: null == subGroupList ? _self.subGroupList : subGroupList // ignore: cast_nullable_to_non_nullable as List, @@ -1277,7 +1278,7 @@ return $default(_that.id,_that.subGroupList);case _: @JsonSerializable() class _GroupOOutput implements GroupOOutput { - const _GroupOOutput({@RfControl() required this.id, @RfArray() required final List subGroupList}): _subGroupList = subGroupList; + const _GroupOOutput({@RfControl() required this.id, @RfArray() required List subGroupList}): _subGroupList = subGroupList; factory _GroupOOutput.fromJson(Map json) => _$GroupOOutputFromJson(json); @override@RfControl() final String id; @@ -1405,7 +1406,7 @@ class _$NestedOOutputCopyWithImpl<$Res> /// Create a copy of NestedOOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? groupList = null,}) { - return _then(_self.copyWith( + return _then(NestedOOutput( groupList: null == groupList ? _self.groupList : groupList // ignore: cast_nullable_to_non_nullable as List, )); @@ -1548,7 +1549,7 @@ return $default(_that.groupList);case _: @JsonSerializable() class _NestedOOutput implements NestedOOutput { - const _NestedOOutput({@RfArray() required final List groupList}): _groupList = groupList; + const _NestedOOutput({@RfArray() required List groupList}): _groupList = groupList; factory _NestedOOutput.fromJson(Map json) => _$NestedOOutputFromJson(json); final List _groupList; diff --git a/packages/reactive_forms_generator/example/lib/docs/nested_generics/nested_generics.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/nested_generics/nested_generics.freezed.dart index 035604e5..a066f960 100644 --- a/packages/reactive_forms_generator/example/lib/docs/nested_generics/nested_generics.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/nested_generics/nested_generics.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'nested_generics.dart'; @@ -9,6 +9,7 @@ part of 'nested_generics.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; /// @nodoc @@ -63,7 +64,7 @@ class _$ProductDetailsCopyWithImpl

/// Create a copy of ProductDetails /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? description = freezed,Object? id = freezed,}) { - return _then(_self.copyWith( + return _then(ProductDetails( description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String?,id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as Id?, @@ -347,7 +348,7 @@ class _$IdCopyWithImpl

/// Create a copy of Id /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? companyName = freezed,Object? name = freezed,}) { - return _then(_self.copyWith( + return _then(Id( companyName: freezed == companyName ? _self.companyName : companyName // ignore: cast_nullable_to_non_nullable as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String?, @@ -607,7 +608,7 @@ class _$ProductCopyWithImpl<$Res> /// Create a copy of Product /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? companyName = freezed,Object? name = freezed,}) { - return _then(_self.copyWith( + return _then(Product( companyName: freezed == companyName ? _self.companyName : companyName // ignore: cast_nullable_to_non_nullable as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String?, @@ -867,7 +868,7 @@ class _$CartCopyWithImpl<$Res> /// Create a copy of Cart /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? product = freezed,Object? description = freezed,}) { - return _then(_self.copyWith( + return _then(Cart( product: freezed == product ? _self.product : product // ignore: cast_nullable_to_non_nullable as Product?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String?, diff --git a/packages/reactive_forms_generator/example/lib/docs/nested_generics/nested_generics_output.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/nested_generics/nested_generics_output.freezed.dart index 749c3a3d..eb1cb07d 100644 --- a/packages/reactive_forms_generator/example/lib/docs/nested_generics/nested_generics_output.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/nested_generics/nested_generics_output.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'nested_generics_output.dart'; @@ -9,6 +9,7 @@ part of 'nested_generics_output.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; /// @nodoc @@ -63,7 +64,7 @@ class _$ProductDetailsOCopyWithImpl

/// Create a copy of ProductDetailsO /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? description = freezed,Object? id = freezed,}) { - return _then(_self.copyWith( + return _then(ProductDetailsO( description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String?,id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as IdO?, @@ -347,7 +348,7 @@ class _$IdOCopyWithImpl

/// Create a copy of IdO /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? companyName = freezed,Object? name = freezed,}) { - return _then(_self.copyWith( + return _then(IdO( companyName: freezed == companyName ? _self.companyName : companyName // ignore: cast_nullable_to_non_nullable as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String?, @@ -607,7 +608,7 @@ class _$ProductCopyWithImpl<$Res> /// Create a copy of Product /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? companyName = freezed,Object? name = freezed,}) { - return _then(_self.copyWith( + return _then(Product( companyName: freezed == companyName ? _self.companyName : companyName // ignore: cast_nullable_to_non_nullable as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String?, @@ -867,7 +868,7 @@ class _$CartCopyWithImpl<$Res> /// Create a copy of Cart /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? product = freezed,Object? description = freezed,}) { - return _then(_self.copyWith( + return _then(Cart( product: freezed == product ? _self.product : product // ignore: cast_nullable_to_non_nullable as Product?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String?, @@ -1151,7 +1152,7 @@ class _$ProductDetailsOOutputCopyWithImpl

/// Create a copy of ProductDetailsOOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? description = freezed,Object? id = freezed,}) { - return _then(_self.copyWith( + return _then(ProductDetailsOOutput( description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String?,id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as IdOOutput?, @@ -1435,7 +1436,7 @@ class _$IdOOutputCopyWithImpl

/// Create a copy of IdOOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? companyName = freezed,Object? name = freezed,}) { - return _then(_self.copyWith( + return _then(IdOOutput( companyName: freezed == companyName ? _self.companyName : companyName // ignore: cast_nullable_to_non_nullable as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String?, diff --git a/packages/reactive_forms_generator/example/lib/docs/profile/profile.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/profile/profile.freezed.dart index a9e90543..a8643b76 100644 --- a/packages/reactive_forms_generator/example/lib/docs/profile/profile.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/profile/profile.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'profile.dart'; @@ -9,6 +9,7 @@ part of 'profile.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; @@ -66,8 +67,8 @@ class _$ProfileCopyWithImpl<$Res> /// Create a copy of Profile /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? anotherId = null,Object? name = null,Object? chartingOrder = null,Object? numberingStandard = null,Object? incidenceFilter = null,Object? measurementType = null,Object? threshold = null,Object? timer = null,Object? audioGuidance = null,}) { - return _then(_self.copyWith( -id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + return _then(Profile( +null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,anotherId: null == anotherId ? _self.anotherId : anotherId // ignore: cast_nullable_to_non_nullable as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String,chartingOrder: null == chartingOrder ? _self.chartingOrder : chartingOrder // ignore: cast_nullable_to_non_nullable @@ -428,7 +429,7 @@ class _$ThresholdSettingCopyWithImpl<$Res> /// Create a copy of ThresholdSetting /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? isEnabled = null,Object? value = null,}) { - return _then(_self.copyWith( + return _then(ThresholdSetting( isEnabled: null == isEnabled ? _self.isEnabled : isEnabled // ignore: cast_nullable_to_non_nullable as bool,value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable as int, @@ -694,7 +695,7 @@ class _$TimerSettingCopyWithImpl<$Res> /// Create a copy of TimerSetting /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? isEnabled = null,Object? value = null,}) { - return _then(_self.copyWith( + return _then(TimerSetting( isEnabled: null == isEnabled ? _self.isEnabled : isEnabled // ignore: cast_nullable_to_non_nullable as bool,value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable as int, @@ -960,7 +961,7 @@ class _$IncidenceFilterCopyWithImpl<$Res> /// Create a copy of IncidenceFilter /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? isMobilityEnabled = null,Object? isFurcationEnabled = null,Object? isBleedingEnabled = null,Object? isSuppurationEnabled = null,Object? isCalculusEnabled = null,Object? isPlaqueEnabled = null,}) { - return _then(_self.copyWith( + return _then(IncidenceFilter( isMobilityEnabled: null == isMobilityEnabled ? _self.isMobilityEnabled : isMobilityEnabled // ignore: cast_nullable_to_non_nullable as bool,isFurcationEnabled: null == isFurcationEnabled ? _self.isFurcationEnabled : isFurcationEnabled // ignore: cast_nullable_to_non_nullable as bool,isBleedingEnabled: null == isBleedingEnabled ? _self.isBleedingEnabled : isBleedingEnabled // ignore: cast_nullable_to_non_nullable @@ -1411,7 +1412,7 @@ return quadrant(_that.quadrant,_that.direction,_that.toothSide);case _: @JsonSerializable() class ArchScanOrder implements ScanOrder { - const ArchScanOrder(this.jaw, {required this.direction, required this.toothSide, final String? $type}): $type = $type ?? 'arch'; + const ArchScanOrder(this.jaw, {required this.direction, required this.toothSide, String? $type}): $type = $type ?? 'arch'; factory ArchScanOrder.fromJson(Map json) => _$ArchScanOrderFromJson(json); final Jaw jaw; @@ -1488,7 +1489,7 @@ as ToothSide, @JsonSerializable() class QuadrantScanOrder implements ScanOrder { - const QuadrantScanOrder(this.quadrant, {required this.direction, required this.toothSide, final String? $type}): $type = $type ?? 'quadrant'; + const QuadrantScanOrder(this.quadrant, {required this.direction, required this.toothSide, String? $type}): $type = $type ?? 'quadrant'; factory QuadrantScanOrder.fromJson(Map json) => _$QuadrantScanOrderFromJson(json); final Quadrant quadrant; @@ -1616,7 +1617,7 @@ class _$ChartingOrderValueCopyWithImpl<$Res> /// Create a copy of ChartingOrderValue /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? chartingOrder = null,Object? selectedOption = null,Object? order = null,}) { - return _then(_self.copyWith( + return _then(ChartingOrderValue( chartingOrder: null == chartingOrder ? _self.chartingOrder : chartingOrder // ignore: cast_nullable_to_non_nullable as ChartingOrderType,selectedOption: null == selectedOption ? _self.selectedOption : selectedOption // ignore: cast_nullable_to_non_nullable as int,order: null == order ? _self.order : order // ignore: cast_nullable_to_non_nullable @@ -1761,7 +1762,7 @@ return $default(_that.chartingOrder,_that.selectedOption,_that.order);case _: @JsonSerializable() class _ChartingOrderValue implements ChartingOrderValue { - const _ChartingOrderValue({this.chartingOrder = ChartingOrderType.arch, this.selectedOption = 0, required final List> order}): _order = order; + const _ChartingOrderValue({this.chartingOrder = ChartingOrderType.arch, this.selectedOption = 0, required List> order}): _order = order; factory _ChartingOrderValue.fromJson(Map json) => _$ChartingOrderValueFromJson(json); @override@JsonKey() final ChartingOrderType chartingOrder; diff --git a/packages/reactive_forms_generator/example/lib/docs/profile/profile_output.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/profile/profile_output.freezed.dart index 2dc4d9b9..cdfb469d 100644 --- a/packages/reactive_forms_generator/example/lib/docs/profile/profile_output.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/profile/profile_output.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'profile_output.dart'; @@ -9,6 +9,7 @@ part of 'profile_output.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; @@ -66,8 +67,8 @@ class _$ProfileOCopyWithImpl<$Res> /// Create a copy of ProfileO /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? anotherId = null,Object? name = null,Object? chartingOrder = null,Object? numberingStandard = null,Object? incidenceFilter = null,Object? measurementType = null,Object? threshold = null,Object? timer = null,Object? audioGuidance = null,}) { - return _then(_self.copyWith( -id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + return _then(ProfileO( +null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,anotherId: null == anotherId ? _self.anotherId : anotherId // ignore: cast_nullable_to_non_nullable as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String,chartingOrder: null == chartingOrder ? _self.chartingOrder : chartingOrder // ignore: cast_nullable_to_non_nullable @@ -428,7 +429,7 @@ class _$ThresholdSettingOCopyWithImpl<$Res> /// Create a copy of ThresholdSettingO /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? isEnabled = null,Object? value = null,}) { - return _then(_self.copyWith( + return _then(ThresholdSettingO( isEnabled: null == isEnabled ? _self.isEnabled : isEnabled // ignore: cast_nullable_to_non_nullable as bool,value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable as int, @@ -694,7 +695,7 @@ class _$TimerSettingOCopyWithImpl<$Res> /// Create a copy of TimerSettingO /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? isEnabled = null,Object? value = null,}) { - return _then(_self.copyWith( + return _then(TimerSettingO( isEnabled: null == isEnabled ? _self.isEnabled : isEnabled // ignore: cast_nullable_to_non_nullable as bool,value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable as int, @@ -960,7 +961,7 @@ class _$IncidenceFilterOCopyWithImpl<$Res> /// Create a copy of IncidenceFilterO /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? isMobilityEnabled = null,Object? isFurcationEnabled = null,Object? isBleedingEnabled = null,Object? isSuppurationEnabled = null,Object? isCalculusEnabled = null,Object? isPlaqueEnabled = null,}) { - return _then(_self.copyWith( + return _then(IncidenceFilterO( isMobilityEnabled: null == isMobilityEnabled ? _self.isMobilityEnabled : isMobilityEnabled // ignore: cast_nullable_to_non_nullable as bool,isFurcationEnabled: null == isFurcationEnabled ? _self.isFurcationEnabled : isFurcationEnabled // ignore: cast_nullable_to_non_nullable as bool,isBleedingEnabled: null == isBleedingEnabled ? _self.isBleedingEnabled : isBleedingEnabled // ignore: cast_nullable_to_non_nullable @@ -1411,7 +1412,7 @@ return quadrant(_that.quadrant,_that.direction,_that.toothSide);case _: @JsonSerializable() class ArchScanOrder implements ScanOrder { - const ArchScanOrder(this.jaw, {required this.direction, required this.toothSide, final String? $type}): $type = $type ?? 'arch'; + const ArchScanOrder(this.jaw, {required this.direction, required this.toothSide, String? $type}): $type = $type ?? 'arch'; factory ArchScanOrder.fromJson(Map json) => _$ArchScanOrderFromJson(json); final Jaw jaw; @@ -1488,7 +1489,7 @@ as ToothSide, @JsonSerializable() class QuadrantScanOrder implements ScanOrder { - const QuadrantScanOrder(this.quadrant, {required this.direction, required this.toothSide, final String? $type}): $type = $type ?? 'quadrant'; + const QuadrantScanOrder(this.quadrant, {required this.direction, required this.toothSide, String? $type}): $type = $type ?? 'quadrant'; factory QuadrantScanOrder.fromJson(Map json) => _$QuadrantScanOrderFromJson(json); final Quadrant quadrant; @@ -1616,7 +1617,7 @@ class _$ChartingOrderValueCopyWithImpl<$Res> /// Create a copy of ChartingOrderValue /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? chartingOrder = null,Object? selectedOption = null,Object? order = null,}) { - return _then(_self.copyWith( + return _then(ChartingOrderValue( chartingOrder: null == chartingOrder ? _self.chartingOrder : chartingOrder // ignore: cast_nullable_to_non_nullable as ChartingOrderType,selectedOption: null == selectedOption ? _self.selectedOption : selectedOption // ignore: cast_nullable_to_non_nullable as int,order: null == order ? _self.order : order // ignore: cast_nullable_to_non_nullable @@ -1761,7 +1762,7 @@ return $default(_that.chartingOrder,_that.selectedOption,_that.order);case _: @JsonSerializable() class _ChartingOrderValue implements ChartingOrderValue { - const _ChartingOrderValue({this.chartingOrder = ChartingOrderType.arch, this.selectedOption = 0, required final List> order}): _order = order; + const _ChartingOrderValue({this.chartingOrder = ChartingOrderType.arch, this.selectedOption = 0, required List> order}): _order = order; factory _ChartingOrderValue.fromJson(Map json) => _$ChartingOrderValueFromJson(json); @override@JsonKey() final ChartingOrderType chartingOrder; @@ -1891,8 +1892,8 @@ class _$ProfileOOutputCopyWithImpl<$Res> /// Create a copy of ProfileOOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? anotherId = null,Object? name = null,Object? chartingOrder = null,Object? numberingStandard = null,Object? incidenceFilter = null,Object? measurementType = null,Object? threshold = null,Object? timer = null,Object? audioGuidance = null,}) { - return _then(_self.copyWith( -id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + return _then(ProfileOOutput( +null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,anotherId: null == anotherId ? _self.anotherId : anotherId // ignore: cast_nullable_to_non_nullable as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String,chartingOrder: null == chartingOrder ? _self.chartingOrder : chartingOrder // ignore: cast_nullable_to_non_nullable @@ -2253,7 +2254,7 @@ class _$ThresholdSettingOOutputCopyWithImpl<$Res> /// Create a copy of ThresholdSettingOOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? isEnabled = null,Object? value = null,}) { - return _then(_self.copyWith( + return _then(ThresholdSettingOOutput( isEnabled: null == isEnabled ? _self.isEnabled : isEnabled // ignore: cast_nullable_to_non_nullable as bool,value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable as int, @@ -2519,7 +2520,7 @@ class _$TimerSettingOOutputCopyWithImpl<$Res> /// Create a copy of TimerSettingOOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? isEnabled = null,Object? value = null,}) { - return _then(_self.copyWith( + return _then(TimerSettingOOutput( isEnabled: null == isEnabled ? _self.isEnabled : isEnabled // ignore: cast_nullable_to_non_nullable as bool,value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable as int, @@ -2785,7 +2786,7 @@ class _$IncidenceFilterOOutputCopyWithImpl<$Res> /// Create a copy of IncidenceFilterOOutput /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? isMobilityEnabled = null,Object? isFurcationEnabled = null,Object? isBleedingEnabled = null,Object? isSuppurationEnabled = null,Object? isCalculusEnabled = null,Object? isPlaqueEnabled = null,}) { - return _then(_self.copyWith( + return _then(IncidenceFilterOOutput( isMobilityEnabled: null == isMobilityEnabled ? _self.isMobilityEnabled : isMobilityEnabled // ignore: cast_nullable_to_non_nullable as bool,isFurcationEnabled: null == isFurcationEnabled ? _self.isFurcationEnabled : isFurcationEnabled // ignore: cast_nullable_to_non_nullable as bool,isBleedingEnabled: null == isBleedingEnabled ? _self.isBleedingEnabled : isBleedingEnabled // ignore: cast_nullable_to_non_nullable diff --git a/packages/reactive_forms_generator/example/lib/docs/recursive/recursive.freezed.dart b/packages/reactive_forms_generator/example/lib/docs/recursive/recursive.freezed.dart index d71ee89e..8b07bce5 100644 --- a/packages/reactive_forms_generator/example/lib/docs/recursive/recursive.freezed.dart +++ b/packages/reactive_forms_generator/example/lib/docs/recursive/recursive.freezed.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'recursive.dart'; @@ -9,6 +9,7 @@ part of 'recursive.dart'; // FreezedGenerator // ************************************************************************** +// GENERATED CODE - DO NOT MODIFY BY HAND // dart format off T _$identity(T value) => value; /// @nodoc @@ -63,7 +64,7 @@ class _$SecuredAreaCopyWithImpl<$Res> /// Create a copy of SecuredArea /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? securedArea = freezed,Object? parcelSystem = freezed,Object? subSecuredAreas = null,}) { - return _then(_self.copyWith( + return _then(SecuredArea( id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String?,securedArea: freezed == securedArea ? _self.securedArea : securedArea // ignore: cast_nullable_to_non_nullable as SecuredArea?,parcelSystem: freezed == parcelSystem ? _self.parcelSystem : parcelSystem // ignore: cast_nullable_to_non_nullable @@ -233,7 +234,7 @@ return $default(_that.id,_that.securedArea,_that.parcelSystem,_that.subSecuredAr class _SecuredArea implements SecuredArea { - const _SecuredArea({this.id, this.securedArea, this.parcelSystem, @RfArray() final List subSecuredAreas = const []}): _subSecuredAreas = subSecuredAreas; + const _SecuredArea({this.id, this.securedArea, this.parcelSystem, @RfArray() List subSecuredAreas = const []}): _subSecuredAreas = subSecuredAreas; @override final String? id; @@ -383,7 +384,7 @@ class _$ParcelSystemCopyWithImpl<$Res> /// Create a copy of ParcelSystem /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? hasParcelSystem = null,Object? data = null,}) { - return _then(_self.copyWith( + return _then(ParcelSystem( hasParcelSystem: null == hasParcelSystem ? _self.hasParcelSystem : hasParcelSystem // ignore: cast_nullable_to_non_nullable as bool,data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable as ParcelSystemData, @@ -661,7 +662,7 @@ class _$ParcelSystemDataCopyWithImpl<$Res> /// Create a copy of ParcelSystemData /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,}) { - return _then(_self.copyWith( + return _then(ParcelSystemData( id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String?, )); diff --git a/packages/reactive_forms_generator/example/pubspec.yaml b/packages/reactive_forms_generator/example/pubspec.yaml index 3c9a772b..bcc91ad3 100644 --- a/packages/reactive_forms_generator/example/pubspec.yaml +++ b/packages/reactive_forms_generator/example/pubspec.yaml @@ -31,6 +31,6 @@ dev_dependencies: flutter_test: sdk: flutter build_runner: ^2.7.0 - freezed: 3.2.6-dev.1 + freezed: 4.0.0-dev.3 json_serializable: ^6.9.5 flutter_lints: ^6.0.0 \ No newline at end of file diff --git a/packages/reactive_forms_generator/lib/src/output/extensions.dart b/packages/reactive_forms_generator/lib/src/output/extensions.dart index b1449a4b..7309408c 100644 --- a/packages/reactive_forms_generator/lib/src/output/extensions.dart +++ b/packages/reactive_forms_generator/lib/src/output/extensions.dart @@ -52,116 +52,87 @@ import 'package:reactive_forms_generator/src/types.dart'; // // } // } -extension NormalFormalParameterImplExt on NormalFormalParameterImpl { - NormalFormalParameterImpl get newParameter { +extension FormalParameterImplExt on FormalParameterImpl { + /// Copy of a plain required positional parameter with the type rewritten. + FormalParameterImpl get newParameter { final parameter = this; + if (parameter is RegularFormalParameterImpl && + parameter.functionTypedSuffix == null) { + return RegularFormalParameterImpl( + comment: null, + metadata: parameter.metadata.toList(), + kind: parameter.kind, + requiredKeyword: parameter.requiredKeyword, + covariantKeyword: parameter.covariantKeyword, + constFinalOrVarKeyword: parameter.constFinalOrVarKeyword, + type: parameter.type?.newType, + name: parameter.name, + functionTypedSuffix: null, + defaultClause: null, + ); + } + return parameter; + } + + /// Rewrite an optional/named parameter into a required named one without a + /// default value, dropping `Default*` annotations. + FormalParameterImpl get newParameter2 { + final parameter = this; + final newMetadata = parameter.metadata + .where((e) => !e.name.toString().startsWith('Default')) + .toList(); switch (parameter) { case FieldFormalParameterImpl _: return FieldFormalParameterImpl( comment: null, - metadata: parameter.metadata, - covariantKeyword: parameter.covariantKeyword, + metadata: newMetadata, + kind: ParameterKind.NAMED_REQUIRED, requiredKeyword: KeywordToken(Keyword.REQUIRED, 0), - name: parameter.name, - keyword: parameter.keyword, + covariantKeyword: parameter.covariantKeyword, + constFinalOrVarKeyword: parameter.constFinalOrVarKeyword, type: parameter.type, thisKeyword: parameter.thisKeyword, period: parameter.period, - typeParameters: parameter.typeParameters, - parameters: parameter.parameters, - question: parameter.question, + name: parameter.name, + functionTypedSuffix: parameter.functionTypedSuffix, + defaultClause: null, ); - case FunctionTypedFormalParameterImpl _: - return this; - case SimpleFormalParameterImpl _: - return SimpleFormalParameterImpl( + case RegularFormalParameterImpl _: + return RegularFormalParameterImpl( comment: null, - metadata: parameter.metadata, - covariantKeyword: parameter.covariantKeyword, + metadata: parameter.functionTypedSuffix != null + ? parameter.metadata.toList() + : newMetadata, + kind: ParameterKind.NAMED_REQUIRED, requiredKeyword: KeywordToken(Keyword.REQUIRED, 0), - keyword: parameter.keyword, - type: parameter.type?.newType, + covariantKeyword: parameter.covariantKeyword, + constFinalOrVarKeyword: parameter.constFinalOrVarKeyword, + type: parameter.functionTypedSuffix != null + ? parameter.type + : parameter.type?.newType, name: parameter.name, + functionTypedSuffix: parameter.functionTypedSuffix, + defaultClause: null, ); case SuperFormalParameterImpl _: - return this; - } - } - - NormalFormalParameterImpl get newParameter2 { - final parameter = this; - switch (parameter) { - case FieldFormalParameterImpl _: - return FieldFormalParameterImpl( + return SuperFormalParameterImpl( comment: null, - metadata: parameter.metadata - .where((e) => !e.name.toString().startsWith('Default')) - .toList(), - covariantKeyword: parameter.covariantKeyword, + metadata: newMetadata, + kind: ParameterKind.NAMED_REQUIRED, requiredKeyword: KeywordToken(Keyword.REQUIRED, 0), - name: parameter.name, - keyword: parameter.keyword, + covariantKeyword: parameter.covariantKeyword, + constFinalOrVarKeyword: parameter.constFinalOrVarKeyword, type: parameter.type, - thisKeyword: parameter.thisKeyword, + superKeyword: parameter.superKeyword, period: parameter.period, - typeParameters: parameter.typeParameters, - parameters: parameter.parameters, - question: parameter.question, - ); - case FunctionTypedFormalParameterImpl _: - return this; - case SimpleFormalParameterImpl _: - return SimpleFormalParameterImpl( - comment: null, - metadata: parameter.metadata - .where((e) => !e.name.toString().startsWith('Default')) - .toList(), - covariantKeyword: parameter.covariantKeyword, - requiredKeyword: KeywordToken(Keyword.REQUIRED, 0), - keyword: parameter.keyword, - type: parameter.type?.newType, name: parameter.name, + functionTypedSuffix: parameter.functionTypedSuffix, + defaultClause: null, ); - case SuperFormalParameterImpl _: - return this; } } } -extension DefaultFormalParameterImplExt on DefaultFormalParameterImpl { - DefaultFormalParameterImpl get newParameter { - return DefaultFormalParameterImpl( - parameter: parameter.newParameter, - kind: ParameterKind.NAMED_REQUIRED, - separator: null, - defaultValue: null, - ); - } - - DefaultFormalParameterImpl get newParameter2 { - return DefaultFormalParameterImpl( - parameter: parameter.newParameter2, - kind: ParameterKind.NAMED_REQUIRED, - separator: null, - defaultValue: null, - ); - } -} - -extension SimpleFormalParameterImplExt on SimpleFormalParameterImpl { - SimpleFormalParameterImpl get newParameter { - return SimpleFormalParameterImpl( - comment: null, - metadata: metadata, - covariantKeyword: covariantKeyword, - requiredKeyword: requiredKeyword, - keyword: keyword, - type: type?.newType, - name: name, - ); - } -} - extension TypeAnnotationImplExt on TypeAnnotationImpl { TypeAnnotationImpl get newType { final type = this; diff --git a/packages/reactive_forms_generator/lib/src/output/helpers.dart b/packages/reactive_forms_generator/lib/src/output/helpers.dart index 40e4a8db..e00e218c 100644 --- a/packages/reactive_forms_generator/lib/src/output/helpers.dart +++ b/packages/reactive_forms_generator/lib/src/output/helpers.dart @@ -1,6 +1,7 @@ // ignore_for_file: implementation_imports import 'package:analyzer/src/dart/ast/utilities.dart'; import 'package:analyzer/src/dart/ast/ast.dart'; +import 'package:analyzer/src/generated/utilities_dart.dart'; import 'package:reactive_forms_generator/src/output/extensions.dart'; void replaceNode(AstNode oldNode, AstNode newNode) { @@ -26,28 +27,27 @@ void replaceR( Map fieldFormalParameter, ) { fieldFormalParameter.forEach((key, node) { - if (node is SimpleFormalParameterImpl) { - replaceNode(node, node.newParameter); - } else if (node is DefaultFormalParameterImpl) { - final parameter = node.parameter; - - if (parameter is SimpleFormalParameterImpl) { - final field = fieldDeclaration[key]; - if (field != null && field is FieldDeclarationImpl) { - replaceNode(field, field.newField); - } + if (node is! FormalParameterImpl) { + return; + } - replaceNode(node, node.newParameter2); + if (node.kind == ParameterKind.REQUIRED) { + // a plain required positional parameter + if (node is RegularFormalParameterImpl && + node.functionTypedSuffix == null) { + replaceNode(node, node.newParameter); } - - if (parameter is FieldFormalParameterImpl) { - final field = fieldDeclaration[key]; - if (field != null && field is FieldDeclarationImpl) { - replaceNode(field, field.newField); - } - - replaceNode(node, node.newParameter2); + } else if ((node is RegularFormalParameterImpl && + node.functionTypedSuffix == null) || + node is FieldFormalParameterImpl) { + // an optional/named parameter — before analyzer 13 these were wrapped + // in the now-removed DefaultFormalParameter + final field = fieldDeclaration[key]; + if (field != null && field is FieldDeclarationImpl) { + replaceNode(field, field.newField); } + + replaceNode(node, node.newParameter2); } }); } diff --git a/packages/reactive_forms_generator/lib/src/output/rf_annotation_arguments.dart b/packages/reactive_forms_generator/lib/src/output/rf_annotation_arguments.dart index 530d393d..98e56dab 100644 --- a/packages/reactive_forms_generator/lib/src/output/rf_annotation_arguments.dart +++ b/packages/reactive_forms_generator/lib/src/output/rf_annotation_arguments.dart @@ -11,27 +11,27 @@ const _rfAnnotationNames = { }; extension AnnotationNamedArguments on Annotation { - Iterable get namedArguments => - arguments?.arguments.whereType() ?? - const []; + Iterable get namedArguments => + arguments?.arguments.whereType() ?? + const []; Expression? namedArgument(String name) { return namedArguments - .firstWhereOrNull((argument) => argument.name.label.name == name) - ?.expression; + .firstWhereOrNull((argument) => argument.name.lexeme == name) + ?.argumentExpression; } Map get namedArgumentExpressions { return Map.unmodifiable({ for (final argument in namedArguments) - argument.name.label.name: argument.expression, + argument.name.lexeme: argument.argumentExpression, }); } Map get namedArgumentSources { return Map.unmodifiable({ for (final argument in namedArguments) - argument.name.label.name: argument.expression.toSource(), + argument.name.lexeme: argument.argumentExpression.toSource(), }); } } diff --git a/packages/reactive_forms_generator/lib/src/output/rf_annotation_arguments_visitor.dart b/packages/reactive_forms_generator/lib/src/output/rf_annotation_arguments_visitor.dart index 9ba03bf0..a79473d4 100644 --- a/packages/reactive_forms_generator/lib/src/output/rf_annotation_arguments_visitor.dart +++ b/packages/reactive_forms_generator/lib/src/output/rf_annotation_arguments_visitor.dart @@ -14,8 +14,8 @@ extension RfAnnotationArguments on Annotation { } for (final argument in argumentList.arguments) { - if (argument is NamedExpression && argument.name.label.name == name) { - return argument.expression; + if (argument is NamedArgument && argument.name.lexeme == name) { + return argument.argumentExpression; } } @@ -30,8 +30,8 @@ extension RfAnnotationArguments on Annotation { final result = {}; for (final argument in argumentList.arguments) { - if (argument is NamedExpression) { - result[argument.name.label.name] = argument.expression.toSource(); + if (argument is NamedArgument) { + result[argument.name.lexeme] = argument.argumentExpression.toSource(); } } diff --git a/packages/reactive_forms_generator/lib/src/output/rf_paramater_visitor.dart b/packages/reactive_forms_generator/lib/src/output/rf_paramater_visitor.dart index 4aa78cf7..4e490a44 100644 --- a/packages/reactive_forms_generator/lib/src/output/rf_paramater_visitor.dart +++ b/packages/reactive_forms_generator/lib/src/output/rf_paramater_visitor.dart @@ -9,6 +9,7 @@ import 'package:analyzer/src/dart/element/type.dart' as t; // import 'package:analyzer/dart/element/visitor.dart'; import 'package:analyzer/src/dart/ast/ast.dart'; +import 'package:analyzer/src/generated/utilities_dart.dart'; import 'package:analyzer/dart/ast/visitor.dart'; import "package:collection/collection.dart"; import 'package:reactive_forms_generator/src/form_elements/form_element_generator.dart'; @@ -39,26 +40,21 @@ class RfParameterVisitor extends GeneralizingAstVisitor { // // } ); // switch (node) { - case DefaultFormalParameterImpl(): - // final p = node; + // an optional/named parameter — before analyzer 13 these were wrapped + // in the now-removed DefaultFormalParameter + case FormalParameterImpl() when node.kind != ParameterKind.REQUIRED: final hasDefaultValue = - node.parameter.declaredFragment?.element.hasDefaultValue == true; - final hasDefaultAnnotation = node.parameter.metadata.fold( + node.declaredFragment?.element.hasDefaultValue == true; + final hasDefaultAnnotation = node.metadata.fold( false, (acc, e) => acc || e.name.toString().startsWith('Default'), ); final hasRfGroupAnnotation = - node - .parameter - .declaredFragment - ?.element - .type - .element - ?.hasRfGroupAnnotation == + node.declaredFragment?.element.type.element?.hasRfGroupAnnotation == true; - final type = node.parameter.declaredFragment?.element.type; + final type = node.declaredFragment?.element.type; final isList = type != null && type.isDartCoreList == true && diff --git a/packages/reactive_forms_generator/lib/src/types.dart b/packages/reactive_forms_generator/lib/src/types.dart index f1e33ff8..4d567cdc 100644 --- a/packages/reactive_forms_generator/lib/src/types.dart +++ b/packages/reactive_forms_generator/lib/src/types.dart @@ -146,11 +146,11 @@ extension ElementRfExt on Element { (meta as ElementAnnotationImpl).annotationAst.arguments as ArgumentListImpl; for (var argument in argumentList.arguments) { - final argumentNamedExpression = argument as NamedExpressionImpl; + final namedArgument = argument as NamedArgumentImpl; result.addEntries([ MapEntry( - argumentNamedExpression.name.label.toSource(), - argumentNamedExpression.expression.toSource(), + namedArgument.name.lexeme, + namedArgument.argumentExpression.toSource(), ), ]); } diff --git a/packages/reactive_forms_generator/pubspec.yaml b/packages/reactive_forms_generator/pubspec.yaml index 1b9933b2..367ce3f2 100644 --- a/packages/reactive_forms_generator/pubspec.yaml +++ b/packages/reactive_forms_generator/pubspec.yaml @@ -2,7 +2,7 @@ name: reactive_forms_generator description: Generator for reactive_forms. Generates form classes based on model. repository: https://github.com/artflutter/reactive_forms_generator -version: 8.5.0 +version: 8.6.0 environment: sdk: ">=3.8.0 <4.0.0" @@ -11,12 +11,12 @@ resolution: workspace dependencies: build: ^4.0.1 source_gen: ^4.1.2 - analyzer: ^12.0.0 + analyzer: ^13.0.0 path: ^1.8.1 build_runner: ^2.7.0 code_builder: ^4.10.1 collection: ">=1.0.0 <2.0.0" - dart_style: ">=3.1.8 <3.1.9" + dart_style: ">=3.1.9 <3.1.10" recase: ^4.1.0 dev_dependencies: diff --git a/pubspec.lock b/pubspec.lock index 65fd9e12..acaf2293 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,26 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: a49d6cf99e8d8e7a8e93668d09ced0bbdb954d0b4fccc2f5f9241c6b87fad95c + sha256: cd6add6f846f35fb79f3c315296703c1a24f3cfd7f4739d91a74961c1c7e9f1b url: "https://pub.dev" source: hosted - version: "99.0.0" + version: "100.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "663efa951fb8a45e06f491223a604c93820598f20e6a99c25617a1576065e8b7" + sha256: "6ba98576948803398b69e3a444df24eacdbe12ed699c7014e120ea38552debbf" url: "https://pub.dev" source: hosted - version: "12.1.0" + version: "13.0.0" + analyzer_buffer: + dependency: transitive + description: + name: analyzer_buffer + sha256: "445b77e2054fa3e8c8a8ef1b5e9e6b23bb8028fffd34b5e60eaef315b7750674" + url: "https://pub.dev" + source: hosted + version: "0.3.3" ansi_styles: dependency: transitive description: @@ -221,10 +229,10 @@ packages: dependency: transitive description: name: dart_style - sha256: a4c1ccfee44c7e75ed80484071a5c142a385345e658fd8bd7c4b5c97e7198f98 + sha256: "59d53ef8eaed9d288ed9767618e2b31c4fa0383a127db59d5eb2e737a7638a60" url: "https://pub.dev" source: hosted - version: "3.1.8" + version: "3.1.9" dartz: dependency: transitive description: @@ -292,10 +300,10 @@ packages: dependency: transitive description: name: freezed - sha256: "8599ba37236328ff6f97269ecce875d251a367eb2929c9bbf9b811b2ce56c74e" + sha256: "9ec135696554923c59339d46dd50adbaf81099be06ffda0fb9c06f410aea9137" url: "https://pub.dev" source: hosted - version: "3.2.6-dev.1" + version: "4.0.0-dev.3" freezed_annotation: dependency: transitive description: @@ -721,26 +729,26 @@ packages: dependency: transitive description: name: test - sha256: "8d9ceddbab833f180fbefed08afa76d7c03513dfdba87ffcec2718b02bbcbf20" + sha256: ca578dc12bb8b2f40b67b7d3bd2fac4f31c01a6ff7130a14e2597b919934507f url: "https://pub.dev" source: hosted - version: "1.31.0" + version: "1.31.1" test_api: - dependency: transitive + dependency: "direct overridden" description: name: test_api - sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e" + sha256: "2a122cbe059f8b610d3a5415f42e255b6c17b1f21eee1d960f31080237fb4f11" url: "https://pub.dev" source: hosted - version: "0.7.11" + version: "0.7.12" test_core: dependency: transitive description: name: test_core - sha256: "1991d4cfe85d5043241acac92962c3977c8d2f2add1ee73130c7b286417d1d34" + sha256: d2e98ec12998368dc59ddd47ab709f2cd55acd6b66dc7db764455a44082f4bc5 url: "https://pub.dev" source: hosted - version: "0.6.17" + version: "0.6.18" typed_data: dependency: transitive description: @@ -830,5 +838,5 @@ packages: source: hosted version: "2.2.4" sdks: - dart: ">=3.10.0 <4.0.0" + dart: ">=3.12.0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.yaml b/pubspec.yaml index c5d3bb54..914a65df 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,3 +12,9 @@ environment: dev_dependencies: build_runner: ^2.4.15 melos: ^7.4.1 + +# unavoidable: flutter_test (Flutter 3.44.9) pins test_api 0.7.11 exactly, while +# test 1.31.1 - the only analyzer 13 compatible release - requires test_api 0.7.12. +# SDK pins cannot be relaxed from package pubspecs, only via an override. +dependency_overrides: + test_api: 0.7.12 From e253e1e268061dff80d6383f2737206222b57d9d Mon Sep 17 00:00:00 2001 From: Vasiliy Ditsyak Date: Fri, 28 Aug 2026 17:06:42 +0200 Subject: [PATCH 2/2] remove IDE settings from repo, ignore .vscode --- .gitignore | 1 + .vscode/settings.json | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index daa9dfa9..4a26c02c 100644 --- a/.gitignore +++ b/.gitignore @@ -79,3 +79,4 @@ build/ # Vs Code related **/.vscode/launch.json +.vscode/ diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 77a35a3c..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "dart.flutterSdkPath": "~/fvm/default" -} \ No newline at end of file