missing_code_block_language_in_doc_comment
A code block is missing a specified language.
此规则自 Dart 3.4 版本起可用。
详情
#DO specify the language used in the code block of a doc comment.
To enable proper syntax highlighting of Markdown code blocks, dart doc
strongly recommends code blocks to specify the language used after the initial code fence.
See highlight.js for the list of languages supported by dart doc
. To disable syntax highlighting or if no language is suitable, you can specify none
as the language.
BAD:
/// ```
/// void main() {}
/// ```
class A {}
GOOD:
/// ```dart
/// void main() {}
/// ```
class A {}
使用方法
#要启用 missing_code_block_language_in_doc_comment
规则,请在你的 analysis_options.yaml
文件中,在 linter > rules 下添加 missing_code_block_language_in_doc_comment
:
linter:
rules:
- missing_code_block_language_in_doc_comment
除非另有说明,否则本网站上的文档反映的是 Dart 3.6.0。页面最后更新于 2025-02-05。 查看源代码 或 报告问题.