Extract Method creates an unnecessary parameter for variable #59775
Labels
analyzer-refactoring
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P3
A lower priority bug or feature request
type-enhancement
A request for a change that isn't a bug
This was originally raised at Dart-Code/Dart-Code#5373 by @stephane-archer.
If you extract code that sets a variable, it becomes a return value for the extracted method. The original variable is also passed as an argument, even if it has never been read in the extracted code and could just be declared inside the new function.
For example:
Becomes:
But since
i
is not read by the extracted method (only written), the parameter could be dropped and instead the variable just declared inside the extracted function:The text was updated successfully, but these errors were encountered: