flutter - Dart @macro 在评论中
问题描述
@macro
飞镖评论中有什么?喜欢
/// The application's top-level routing table.
///
/// When a named route is pushed with [Navigator.pushNamed], the route name is
/// looked up in this map. If the name is present, the associated
/// [WidgetBuilder] is used to construct a [MaterialPageRoute] that performs
/// an appropriate transition, including [Hero] animations, to the new route.
///
/// {@macro flutter.widgets.widgetsApp.routes}
final Map<String, WidgetBuilder> routes;
解决方案
它是 dartdoc 的一部分
https://pub.dev/packages/dartdoc#macros
宏
您可以指定“宏”,即可重复使用的文档。为此,首先在评论中的任意位置指定一个模板,例如:
/// {@template template_name}
/// Some shared docs
/// {@endtemplate}
然后你可以通过 插入它{@macro template_name}
,比如
/// Some comment
/// {@macro template_name}
/// More comments
模板定义目前没有作用域——如果 dartdoc 读取包含模板的文件,它可以用于 dartdoc 当前正在记录的任何内容。这可能会导致在不同包上运行之间的行为不一致,尤其是当 dartdoc 使用不同的命令行时。建议对任何宏使用防冲突命名,方法是在名称中包含包名称和/或定义它的库。
推荐阅读
- node.js - 从 heroku 仪表板查看文件/文件夹
- javascript - Angular:单击保存时,保持所有选项卡不变
- rest - 我在 localhost 中运行的 API 的自定义端口号
- azure - Azure Sentinel 工作簿由于缓存而显示旧数据
- python - 在 python 套接字中按块发送大消息会更好吗?
- javascript - 更改标题处的日期格式 - NGX-Print
- azure - 在 Azure ARM 模板重新部署期间是否保留了自定义 DNS 名称和 TLS 绑定?
- laravel - SQLSTATE [42S22]:未找到列:1054 'where 子句'中的未知列 'id'(SQL:从 `posts` 中选择 count(*) 作为聚合,其中`id` =
- python - Python socket tcp 与 ROS 上的子进程通信
- openstreetmap - 返回城市区域的多边形位置