Skip to content

New no_leading_understore_in_function_variables #58443

@moneer-muntazah

Description

@moneer-muntazah

I'm not sure if this is already included, but I couldn't find it anywhere.

The dart underscore for private members makes it easy to tell that a construct is private just by looking at its name, but I noticed that sometimes it's misused. and variable names in functions are decaled with a leading underscore. I see no value of doing so since the variable scope is already confined to the function or statement it's declared in.

for instance

void foo() {
 int _answer = 42;
}

I would like a lint rule to discourage this behavior.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions