Skip to content

fix: quickfix deletes active functionality when removing unused variable #137

@GuilhermeConstantino

Description

@GuilhermeConstantino

Description

Linter will remove function calls when made to a unused variable, even though the function itself might still be needed.

Steps To Reproduce

  1. Create a variable that receives the result of a function but is unused
  2. Accept the quickfix

Expected Behavior

Future _postSomething(var something) {
final result = sendPostRequest(something);
}
Now since I didn't do anything with the result, it will cause a unused_local_variable linter
And when I select the "Remove unused local variable" quickfix it will delete the whole send, not just the variable.

Wanted result:
Future _postSomething(var something) {
sendPostRequest(something);
}

Actual result:
Future _postSomething(var something) {
}

Additional Context

The linter deleted some of my app functionality instead of just the variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as expected

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions