no_leading_underscores_for_library_prefixes

Stable
Recommended
Fix available

Avoid leading underscores for library prefixes.

Details

#

DON'T use a leading underscore for library prefixes. There is no concept of "private" for library prefixes. When one of those has a name that starts with an underscore, it sends a confusing signal to the reader. To avoid that, don't use leading underscores in those names.

BAD:

dart
import 'dart:core' as _core;

GOOD:

dart
import 'dart:core' as core;

Enable

#

To enable the no_leading_underscores_for_library_prefixes rule, add no_leading_underscores_for_library_prefixes under linter > rules in your analysis_options.yaml file:

analysis_options.yaml
yaml
linter:
  rules:
    - no_leading_underscores_for_library_prefixes

If you're instead using the YAML map syntax to configure linter rules, add no_leading_underscores_for_library_prefixes: true under linter > rules:

analysis_options.yaml
yaml
linter:
  rules:
    no_leading_underscores_for_library_prefixes: true