如何参考现有文档

How to refer to existing documentation

这是我要完成的示例。

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

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

所以方法 2 的文档将是:

This is a doc string for this method.
method 2 doc string added to method1's here.

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

dart 中的正确语法是什么?

这正是我想要的,感谢@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