Skip to content

Add type annotation incorrectly includes default values for function types #4312

Closed
@mosuem

Description

@mosuem

Describe the bug
The Add type annotation produces the wrong code for type Function with default values.

To Reproduce
Steps to reproduce the behavior:

  1. Create a class ClassName with a constructor with default values, such as String name = "".
  2. Call ClassName.new somewhere.
  3. Call the Add type annotation quickfix
  4. The type will be ClassName Function(String name = ""), which is marked with the default_value_in_function_type error.

Expected behavior
The type should drop the default values.

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