跳至主要內容

non_constant_identifier_names

穩定版
核心
提供修正

使用 lowerCamelCase 命名非常數識別符。

詳細資訊

#

務必 使用 lowerCamelCase 命名非常數識別符。

類別成員、頂層定義、變數、參數、具名參數和具名建構子應將除了第一個單字以外的每個單字的第一個字母大寫,且不使用分隔符號。

良好

dart
var item;

HttpRequest httpRequest;

align(clearItems) {
  // ...
}

啟用

#

若要啟用 non_constant_identifier_names 規則,請在您的 analysis_options.yaml 檔案中的 linter > rules 下新增 non_constant_identifier_names

analysis_options.yaml
yaml
linter:
  rules:
    - non_constant_identifier_names

如果您改用 YAML map 語法來設定 linter 規則,請在 linter > rules 下新增 non_constant_identifier_names: true

analysis_options.yaml
yaml
linter:
  rules:
    non_constant_identifier_names: true