no_leading_underscores_for_library_prefixes
Avoid leading underscores for library prefixes.
This rule is available as of Dart 2.16.
Rule sets: recommended, flutter
This rule has a quick fix available.
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;
Usage
#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
除非另有说明,文档之所提及适用于 Dart 3.5.3 版本,本页面最后更新时间: 2024-08-02。 查看文档源码 或者 报告页面问题。