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