Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated properties do not translate #64

Open
mrgnhnt96 opened this issue Sep 6, 2022 · 0 comments
Open

Deprecated properties do not translate #64

mrgnhnt96 opened this issue Sep 6, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@mrgnhnt96
Copy link
Contributor

Describe the issue

As a developer, deprecating fields is sometimes needed. Deprecating the field will trigger a lint throughout the project to alert the developer to avoid using this parameter/property. With the copyWith extension, this is not included. It would be nice to have the copyWith reflect the same deprecation annotation within the generated code.

Environment details

`flutter doctor`
[✓] Flutter (Channel stable, 3.3.0, on macOS 12.5 21G72 darwin-arm (Rosetta), locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.71.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!
`flutter --version`
Flutter 3.3.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ffccd96b62 (8 days ago) • 2022-08-29 17:28:57 -0700
Engine • revision 5e9e0e0aa8
Tools • Dart 2.18.0 • DevTools 2.15.0
package version
dependencies:
  copy_with_extension: 4.0.3
dev_dependencies:
  copy_with_extension_gen: 4.0.3

To Reproduce

@CopyWith()
class User {
  const User({
    @Deprecated('use `firstName` instead')
    String? name,
    required this.firstName,
  }): name = name ?? firstName;

  @Deprecated('use `firstName` instead')
  final String name;
  final String firstName;
}
// somewhere else in your code
final user = User(firstName: 'Spongebob');

user.copyWith(
  name: // deprecated lint warning expected here
);

Expected behaviour

Lint warning on all deprecated copyWith parameters

@numen31337 numen31337 added the enhancement New feature or request label Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants