From 4142dc38357abec4eadab7af7241546d3716de79 Mon Sep 17 00:00:00 2001 From: "Vladimir E. Koltunov" Date: Mon, 27 Feb 2023 00:29:16 +0300 Subject: [PATCH] eliminates Warning: Operand of null-aware operation (#76) * Update copy_with_generator.dart * Update pubspec.yaml * remove unnecessary ignore comment. * removed unnecessary cast_nullable_to_non_nullable comment * Update pubspec.yaml * Update copy_with_generator.dart removed unnecessary ! cast * Update pubspec.yaml * Update copy_with_generator.dart ! for non nullable fields * Update pubspec.yaml * Update copy_with_generator.dart * Update pubspec.yaml * Update copy_with_generator.dart * Update pubspec.yaml --- copy_with_extension_gen/lib/src/copy_with_generator.dart | 6 +----- copy_with_extension_gen/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/copy_with_extension_gen/lib/src/copy_with_generator.dart b/copy_with_extension_gen/lib/src/copy_with_generator.dart index 19669ec..b2a68d6 100644 --- a/copy_with_extension_gen/lib/src/copy_with_generator.dart +++ b/copy_with_extension_gen/lib/src/copy_with_generator.dart @@ -180,13 +180,9 @@ class CopyWithGenerator extends GeneratorForAnnotation { final nullCheckForNonNullable = v.nullable ? "" : "|| ${v.name} == null"; - /// The `!` operator is needed to overcome a possible issue described here https://github.com/numen31337/copy_with_extension/pull/69#issue-1433703875 return '''$r ${v.isPositioned ? "" : '${v.name}:'} ${v.name} == const \$CopyWithPlaceholder() $nullCheckForNonNullable - ${v.nullable ? '' : '// ignore: unnecessary_non_null_assertion'} - ? _value.${v.name}${v.nullable ? '' : '!'} - // ignore: cast_nullable_to_non_nullable - : ${v.name} as ${v.type},'''; + ? _value.${v.name} : ${v.name} as ${v.type},'''; }, ); diff --git a/copy_with_extension_gen/pubspec.yaml b/copy_with_extension_gen/pubspec.yaml index 76aa94e..9a28286 100644 --- a/copy_with_extension_gen/pubspec.yaml +++ b/copy_with_extension_gen/pubspec.yaml @@ -1,5 +1,5 @@ name: copy_with_extension_gen -version: 5.0.0 +version: 5.0.0+6 description: Automatically generating `copyWith` extensions code for classes with `@CopyWith()` annotation. repository: https://github.com/numen31337/copy_with_extension homepage: https://github.com/numen31337/copy_with_extension/tree/master/copy_with_extension_gen