Skip to content

[linter] adding unnecessary_statements to the "recommended rule set" #59732

Closed
@stephane-archer

Description

void bar() {
  print('hello world');
}
void main() {
  /// a lot of code
  bar;
  /// a lot of code
}

I was debugging and could not figure out why my code wasn't working and why I wasn't breaking in bar...

Can we have a linter to detect this kind of statement: functionName;?
From my understanding, these types of statements are not doing anything.
The author probably meats functionName(); if it wasn't passed to anything.

Metadata

Assignees

No one assigned

    Labels

    area-analyzerUse area-analyzer for Dart analyzer issues, including the analysis server and code completion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions