【问题标题】:Differences between Doc comments and Comments in DartDart 中 Doc 注释和 Comments 的区别
【发布时间】:2020-04-11 16:46:45
【问题描述】:

可能看起来很简单,但我很想知道 Doc Comments 和 Dart 中的 Comments 之间的确切区别。

///这是一个文档评论

//这是一个评论

在我看来,在这里提问和回答也可以对其他人有所帮助:)

【问题讨论】:

    标签: flutter dart comments


    【解决方案1】:

    评论 (//)

    注释通常用于注释掉你的代码的某些部分,或者在你的代码中添加一些cmet,你想和你的队友交流。

    文档注释 (///)

    文档注释用于文档目的。 dartdoc 解析 doc cmets 并创建文档页面。

    +--------------------------------------------+-----------------------------------------------------+
    | Comments                                   | Doc Comments                                        |
    +--------------------------------------------+-----------------------------------------------------+
    |  - Comment out some part of your code      | - Anything that you want to document using dartdoc  |
    |  - Private APIs                            | - Usually used for public API/Framework/Library     |
    |  - Private variable declaration            |                                                     |
    |  - Method implementation logic             |                                                     |
    |  - Something you need to do in future      |                                                     |
    |    for improvements or cleanup purpose etc |                                                     |
    +--------------------------------------------+-----------------------------------------------------+
    

    你可以在Effective Dart - Documentation阅读更多关于这些的信息

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-25
      • 2013-12-22
      • 1970-01-01
      • 2018-01-14
      • 1970-01-01
      • 2015-05-08
      • 1970-01-01
      相关资源
      最近更新 更多