gpt4 book ai didi

flutter - 如何在 Dart 和 Flutter 中创建 DartDoc 宏/模板?

转载 作者:行者123 更新时间:2023-12-03 02:59:56 30 4
gpt4 key购买 nike

我在整个 Flutter 仓库中看到过如下片段:

/// {@macro flutter.widgets.editableText.readOnly}
在 IDE 和渲染的 Dart 文档中,它是 shown like this :

Whether the text can be changed.

When this is set to true, the text cannot be modified by any shortcut or keyboard operation. The text is still selectable.

Defaults to false. Must not be null.


它往往远远超出这个基本情况。

最佳答案

您可以创建 模板并将它们用作 使用 dartdoc ,这是 Flutter 自带的默认 API 文档包。
只需定义一个 @template在您的文档中的任何位置:

/// {@template template_name}
/// Some shared docs
/// {@endtemplate}
现在,您可以在其他任何地方重用它:
/// Some comment
/// {@macro template_name}
/// More comments
Learn more .

关于flutter - 如何在 Dart 和 Flutter 中创建 DartDoc 宏/模板?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62763658/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com