no_leading_underscores_for_library_prefixes
避免库前缀使用前导下划线。
详情
#不要对库前缀使用前导下划线。库前缀没有“私有”的概念。当其中一个名称以下划线开头时,会给读者发送一个令人困惑的信号。为避免这种情况,请勿在这些名称中使用前导下划线。
差
dart
import 'dart:core' as _core;
好
dart
import 'dart:core' as core;
启用
#要启用 no_leading_underscores_for_library_prefixes
规则,请在您的 analysis_options.yaml
文件的 linter > rules 下添加 no_leading_underscores_for_library_prefixes
analysis_options.yaml
yaml
linter:
rules:
- no_leading_underscores_for_library_prefixes
如果您使用的是 YAML 映射语法来配置 linter 规则,请在 linter > rules 下添加 no_leading_underscores_for_library_prefixes: true
analysis_options.yaml
yaml
linter:
rules:
no_leading_underscores_for_library_prefixes: true