目录

slash_for_doc_comments

Prefer using /// for doc comments.

此规则自 Dart 2.0 版本起可用。

_规则集:recommended , flutter _

此规则提供 快速修复

详情

#

From Effective Dart:

DO use /// for documentation comments.

Although Dart supports two syntaxes of doc comments (/// and /**), we prefer using /// for doc comments.

GOOD:

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) {
  // ...
}

Within a doc comment, you can use markdown for formatting.

使用方法

#

要启用 slash_for_doc_comments 规则,请在你的 analysis_options.yaml 文件中,在 linter > rules 下添加 slash_for_doc_comments

analysis_options.yaml
yaml
linter:
  rules:
    - slash_for_doc_comments