跳到主要內容

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 對映語法配置 linter 規則,請在 linter > rules 下新增 slash_for_doc_comments: true

analysis_options.yaml
yaml
linter:
  rules:
    slash_for_doc_comments: true