unintended_html_in_doc_comment
Angle brackets will be interpreted as HTML.
Description
#The analyzer produces this diagnostic when a documentation comment
contains angle bracketed text (<...>
) that isn't one of the allowed
exceptions.
Such text is interpreted by markdown to be an HTML tag, which is rarely what was intended.
See the lint rule description for the list of allowed exceptions.
Example
#The following code produces this diagnostic because the documentation
comment contains the text <int>
, which isn't one of the allowed
exceptions:
/// Converts a List<int> to a comma-separated String.
String f(List<int> l) => '';
Common fixes
#If the text was intended to be part of a code span, then add backticks around the code:
/// Converts a `List<int>` to a comma-separated String.
String f(List<int> l) => '';
If the text was intended to be part of a link, then add square brackets around the code:
/// Converts a [List<int>] to a comma-separated String.
String f(List<int> l) => '';
If the text was intended to be printed as-is, including the angle brackets, then add backslash escapes before the angle brackets:
/// Converts a List\<int\> to a comma-separated String.
String f(List<int> l) => '';
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。