Thanks to visit codestin.com
Credit goes to github.com

Skip to content

proposal: no_leading_underscore_for_local_functions #58664

Closed
@srawlins

Description

@srawlins

no_leading_underscore_for_local_functions

Description

Do not name local functions with a leading underscore: their visibility is dictated by local scope. Similar to no_leading_underscore_for_local_variables.

Details

no_leading_underscore_for_local_variables does not trigger on local functions. Rather than treat that as a false negative, which is hard to land, we can just create a new rule.

I often catch this in readability reviews.

Kind

Does this enforce style advice? Guard against errors? Other?

Style, I suppose. Meets with Effective Dart recommendations.

Good Examples

void foo10() {
  void foo11() {}
}

Bad Examples

void foo10() {
  void _foo11() {}
}

Discussion

Discussion checklist

  • List any existing rules this proposal complements, overlaps or conflict with.
  • List any relevant issues (reported here, the SDK Tracker, or elsewhere).
  • If there's any prior art (e.g., in other linters), please add references here.
  • If this proposal corresponds to Effective Dart or Flutter Style Guide advice, please call it out. (If there isn’t any corresponding advice, should there be?)
  • If this proposal is motivated by real-world examples, please provide as many details as you can. Demonstrating potential impact is especially valuable.

Metadata

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