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 map 語法來設定 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。 檢視原始碼 或 回報問題。