slash_for_doc_comments
推荐使用 ///
作为文档注释。
详情
#务必使用 ///
作为文档注释。
尽管 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