使用 dart 可以通过注释作为类/函数定义的前缀,以便分析器将其解释为文档:
/// Some documentation for [Foo]
class Foo {
}
Run Code Online (Sandbox Code Playgroud)
但是如何使用参数来实现相同的行为呢?
我尝试了以下方法:
void myFunction(
/// Some parameter documentation
String parameter,
) {
}
Run Code Online (Sandbox Code Playgroud)
但这不起作用。
但是,这似乎是可能的,因为dartanalyzer 确实包含ParameterElement文档的属性。
小智 4
https://www.dartlang.org/guides/language/ effective-dart/documentation
以下是文档最佳实践的官方 Dart 语言指南。它涵盖了大多数/所有情况,并提供了注意事项的精彩示例。
该位显示包含参数的方式。基本上,将参数放在方括号中并放在解释它的句子中。
| 归档时间: |
|
| 查看次数: |
1378 次 |
| 最近记录: |