【问题标题】:Linking to classes within Dart comments for documentation链接到 Dart 注释中的类以获取文档
【发布时间】:2018-07-11 04:18:27
【问题描述】:

有没有办法使用 Dart 文档 cmets 链接到另一个类。

在 JavaDoc 中,您可以在评论中使用 @see com.my.package.Class#method(),当您单击评论时,IDE 会将您带到 com.my.package.Class。 Dart 有等效的语法吗?

【问题讨论】:

    标签: dart


    【解决方案1】:

    你可以在 DartDoc 中使用 markdown 链接,所以:

    /// Floos the ploink.
    ///
    /// The [Ploink] provided as [ploink] is [Ploink.floo]'d.
    ///
    /// Returns the [Floo] resulting from the `floo`'ing of [ploink].
    ///
    /// See also [FlooPloinker] for a class that does the same.
    Floo flooThePloink(Ploink ploink) => ploink.floo();
    

    [] 中的任何内容都是链接。您也可以将外部链接设为[HTTP](https://tools.ietf.org/html/rfc7231),但如果大括号后面没有任何内容,则将其视为内部 DartDoc 链接,并像该标识符一样在被评论的内容中解析。这包括指向 [Object] 之类的类或 [Object.hashCode] 之类的方法的链接。 你必须自己写“看到”,DartDoc 中没有神奇的@ 标记,只有散文和链接。

    您确实需要能够引用该类,因此您不能对尚未在库中导入的类进行 dart-doc 引用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-30
      • 2020-11-13
      • 2020-01-13
      • 2022-12-19
      • 1970-01-01
      • 2012-01-09
      • 2021-08-04
      相关资源
      最近更新 更多