跳到主要内容

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