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
除非另有说明,否则本网站上的文档反映的是 Dart 3.7.1 版本。页面上次更新于 2025-03-07。 查看源代码 或 报告问题。