Skip to content

Please don't remove unused parameters from function definitions on Save #4655

@lukehutch

Description

@lukehutch

Describe the bug

Create this class:

class _MyClass {
  int? param;
  _MyClass({
    this.param,
  });
}

Now hit save. You get:

class _MyClass {
  int? param;
  _MyClass();
}

this.param is removed automatically, because it is (as yet) unused.

This is not good default behavior. (Or maybe I accidentally enabled it in my settings, but it's not good behavior in general.)

Please complete the following information:

  • Operating System and version: Linux
  • VS Code version: code-1.80.1-1689183644.el7.x86_64
  • Dart extension version:
  • Dart/Flutter SDK version: 3.0.6
  • Target device (if the issue relates to Flutter debugging):

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions