unintended_html_in_doc_comment
尖括號將被解釋為 HTML。
描述
#當文件註釋包含不在允許例外列表中的尖括號括起來的文字(<...>)時,分析器會產生此診斷。
markdown 會將此類文字解釋為 HTML 標籤,這通常不是預期的結果。
請參閱Lint 規則描述以獲取允許例外的列表。
示例
#以下程式碼會產生此診斷,因為文件註釋包含了文字 <int>,這不在允許例外列表之中。
dart
/// Converts a List<int> to a comma-separated String.
String f(List<int> l) => '';常見修復
#如果文字是程式碼片段的一部分,請在程式碼周圍新增反引號。
dart
/// Converts a `List<int>` to a comma-separated String.
String f(List<int> l) => '';如果文字是連結的一部分,請在程式碼周圍新增方括號。
dart
/// Converts a [List<int>] to a comma-separated String.
String f(List<int> l) => '';如果 intended 文字需要按原樣列印(包括尖括號),請在尖括號前新增反斜槓轉義符。
dart
/// Converts a List\<int\> to a comma-separated String.
String f(List<int> l) => '';