no_leading_underscores_for_library_prefixes
Avoid leading underscores for library prefixes.
此规则自 Dart 2.16 版本起可用。
_规则集:recommended , flutter _
此规则提供 快速修复 。
详情
#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;
使用方法
#要启用 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
除非另有说明,否则本网站上的文档反映的是 Dart 3.6.0。页面最后更新于 2025-02-05。 查看源代码 或 报告问题.