Skip to content

Convert to StatefulWidget adds an extra underscore to private widgets #3343

@jorgecoca

Description

@jorgecoca

Describe the bug
If you have a private StatelessWidget that you'd like to turn into a StatefulWidget, when you using the VS Code helper to do so your new State class will be prefixed with an extra underscore:

For example, if your class name was _MyCustomWidget, when using Convert to StatefulWidget the new state generated will be__MyCustomWidgetState (notice the two underscores at the beginning)

To Reproduce

  1. Create a private StatelessWidget
  2. Click on Convert to StatefulWidget and see the new state being prefixed by 2 underscores.
    Screen Shot 2021-05-14 at 9 13 37 AM

Expected behavior
The new state generated only has one underscore.

Versions (please complete the following information):

  • VS Code version: 1.56.2
  • Dart extension version: 3.22.0
  • Dart/Flutter SDK version: Flutter (Channel beta, 2.2.0-10.3.pre, on macOS 11.2.3 20D91 darwin-x64, locale en-US)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions