如何在安卓工作室中自动生成飞镖函数的标题注释?



我们可以通过在 Android Studio 中为 Kotlin/Java 函数键入/** + Enter来添加标题注释。是否有任何快捷方式或插件可用于生成颤振飞镖的评论?

不幸的是,Dart 不遵循与 Java/Kotlin 相同的约定。

关于有效飞镖的指南是关于文档的,其中指出:

Dart 中的约定是将其集成到方法的描述中,并使用方括号突出显示参数。

其中"...verbose tags and sections to describe what the parameters and returns of a method are"的词.文档应用散文编写。

所以这个 Java 方法文档:

/// Defines a flag with the given name and abbreviation.
///
/// @param name The name of the flag.
/// @param abbr The abbreviation for the flag.
/// @returns The new flag.
/// @throws ArgumentError If there is already an option with
///     the given name or abbreviation.
Flag addFlag(String name, String abbr) => ...

相当于在《飞镖》中:

/// Defines a flag.
///
/// Throws an [ArgumentError] if there is already an option named [name] or
/// there is already an option using abbreviation [abbr]. Returns the new flag.
Flag addFlag(String name, String abbr) => ...

若要使用 Dart 文档注释,请键入///并按Enter键。

最新更新