【问题标题】:How to refer to existing documentation如何参考现有文档
【发布时间】:2021-07-17 20:35:36
【问题描述】:

这是我想要完成的一个示例。

/// This is a doc string for this method. 
method1(){}

@method1DocString
////method 2 doc string added to method1's here.
method2(){}

所以method2的文档是:

这是此方法的文档字符串。
方法 2 文档字符串添加到方法 1 的此处。

我很确定我以前见过这样做。无需在适用的情况下重写文档。还可以更轻松地维护准确的文档。

在 dart 中正确的语法是什么?

【问题讨论】:

  • 啊,是的,正是我想要的!太感谢了。如果你把它作为一个答案,我会接受它
  • 欢迎您写一个自我回答然后;-)

标签: flutter dart dartdoc


【解决方案1】:

这正是我想要的,感谢@pskink:

/// {@template method1_documentation}
/// This is a doc string for this method. 
/// {@endtemplate}
method1(){}

/// {@macro method1_documentation}
/// method 2 doc string added to method1's here.
method2(){}

在文档中:https://pub.dev/packages/dartdoc#macros

【讨论】:

    猜你喜欢
    • 2016-03-03
    • 1970-01-01
    • 2012-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-25
    • 2023-03-20
    • 1970-01-01
    相关资源
    最近更新 更多