跳到主要內容

slash_for_doc_comments

穩定
推薦
可用的修正

建議使用 /// 作為文件註解。

詳細資訊

#

出自Effective Dart

務必使用 /// 作為文件註解。

雖然 Dart 支援兩種文件註解語法 (////**),但我們偏好使用 /// 作為文件註解。

良好

dart
/// Parses a set of option strings. For each option:
///
/// * If it is `null`, then it is ignored.
/// * If it is a string, then [validate] is called on it.
/// * If it is any other type, it is *not* validated.
void parse(List options) {
  // ...
}

在文件註解中,您可以使用 markdown 進行格式設定。

啟用

#

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

analysis_options.yaml
yaml
linter:
  rules:
    - slash_for_doc_comments

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

analysis_options.yaml
yaml
linter:
  rules:
    slash_for_doc_comments: true