メインコンテンツにスキップ

slash_for_doc_comments

安定版
推奨
修正が利用可能です

ドキュメントコメントには /// を使用してください。

詳細

#

Effective Dart」より

DO ドキュメントコメントには /// を使用してください。

Dart はドキュメントコメントの構文として ////** の 2 つをサポートしていますが、ドキュメントコメントには /// を使用することを推奨します。

良い例

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 > rules の下に slash_for_doc_comments: true を追加します。

analysis_options.yaml
yaml
linter:
  rules:
    slash_for_doc_comments: true