"Extract method" refactor should support multiple return values if records are enabled. #51990
Labels
area-devexp
For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.
devexp-refactoring
Issues with analysis server refactorings
P3
A lower priority bug or feature request
type-enhancement
A request for a change that isn't a bug
Prior to Dart 3.0, if a user selected a block of text in a method and triggered the "extract method" refactor, the refactor would fail if the extracted method would have to return multiple values.
Now that records (and patterns) have been added to Dart, this restriction should not be necessary anymore, since multiple return values can be handled using records now.
Note that there are some tricky cases, though. Traditional "extract method" behaves differently depending whether the returned variable is both an input and an output to the extracted method, or just an output. (In the former case, it replaces the method with a variable assignment; in the latter, it replaces the method with a variable declaration). It may require some ingenuity to handle the case where some variables are both an input and an output, while others are just an output 😃.
The text was updated successfully, but these errors were encountered: