woprandi · GitHub

Describe the bug
"wrap with widget" wraps the entire switch expression instead of the current branch

To Reproduce

enum MyEnum {a, b}
class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return switch(get()) {
        MyEnum.a =>  const Text('a'),
        MyEnum.b =>  const Text('b'),
    };
  }
}
MyEnum get() {
// ...
}

Move your cursor to Text('a') and do a "Wrap with widget..." (or anything else)

Expected behavior
The new widget should be parent of the Text('a') branch and not of the entire switch expression

Screenshots
If applicable, add screenshots to help explain your problem.

Please complete the following information:

  • Operating System and version: Fedora 38
  • VS Code version: 1.82.2
  • Dart extension version: 3.72.2
  • Dart/Flutter SDK version: 3.1.2 / 3.13.5
  • Target device (if the issue relates to Flutter debugging):

Read the original on github.com ↗