Skip to content

Consider adding unnecessary_statements to the recommended set #844

Open
@DanTup

Description

I was asked today by a new Dart developer why his code didn't produce any diagnostics when he'd missed the () from the end of a method call:

state.foo;

This isn't the first time this has come up to me, and it's also been asked for in the SDK. It seems like a useful lint and it seems like the false positives are real edge cases (like side effects in operators) so I wonder if it would be useful to recommend?

Some issues requesting this (or issues that it may have been avoided if it was used):

Additionally, it is enabled in the Flutter repository:

Possible false positives I can find are all related to operators with side effects (which I think is probably acceptable - I don't think this is common, except perhaps while print-debugging!):

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions