目錄

no_leading_underscores_for_library_prefixes

避免程式庫前置字元使用底線。

此規則自 Dart 2.16 起可用。

規則集:建議flutter

此規則有可用的快速修正

詳細資料

#

請勿在程式庫前置字元使用前導底線。程式庫前置字元沒有「私有」的概念。當其中一個的名稱以底線開頭時,會向讀者發出混淆的訊號。為了避免這種情況,請勿在這些名稱中使用前導底線。

錯誤範例

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