Remove unused local variable
can inadvertently remove code with side effects
#53820
Labels
analyzer-quick-fix
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P2
A bug or feature request we're likely to work on
Given the following code:
the analyzer gives a fix suggestion of
Remove unused local variable
. Unfortunately the result of running this action is:Since VS Code runs this action on save, it's a good way to lose code that has side effects, if you habitually hit Ctrl+S all the time like I do.
I would expect the result to be the following, assuming the analyzer can't actually tell if the function call has any side effects or not (and the fix should probably be renamed
Remove unused local variable declaration
in this case):Dart info:
The text was updated successfully, but these errors were encountered: