目錄

slash_for_doc_comments

建議使用 /// 作為文件註解。

此規則自 Dart 2.0 起可用。

規則集:建議flutter

此規則有快速修正可用。

詳細資訊

#

來自Effective Dart

使用 /// 作為文件註解。

雖然 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