Merrit · GitHub

Describe the bug
Using the refactor feature to convert a getter to a method doesn't work if said getter is part of an extension.

To Reproduce
Steps to reproduce the behavior:

  1. Add a getter to an extension
  2. Right click getter name -> Refactor -> Convert Getter to Method

Expected behavior
Getter should be changed to a method.

Example:

enum Category {
  metal,
  wood,
  glass,
}
extension ExtraEnumFuntionality on Category {
  String get someValue => 'returnValue'; // FAIL
}
class SomeClass {
  String get aValue => 'aReturnValue'; // SUCCESS
}
extension ExtraClassFunctionality on SomeClass {
  String get someValue => 'returnValue'; // FAIL
}

Versions (please complete the following information):

  • VS Code version: 1.64.2
  • Dart extension version: 3.34.0
  • Dart/Flutter SDK version: Flutter 2.11.0-0.1.pre, Dart 2.17.0

Read the original on github.com ↗