在mirrors.dart源代码中,您可以找到以下内容:
/**
* Class used for encoding comments as metadata annotations.
*/
class Comment {
/**
* The comment text as written in the source text.
*/
final String text;
/**
* The comment text without the start, end, and padding text.
*
* For example, if [text] is [: /** Comment text. */ :] then the [trimmedText]
* is [: Comment text. :].
*/
final String trimmedText;
/**
* Is [:true:] if this comment is a documentation comment.
*
* That is, that the comment is either enclosed in [: /** ... */ :] or starts
* with [: /// :].
*/
final bool isDocComment;
const Comment(this.text, this.trimmedText, this.isDocComment);
}但是,该类不在其他地方使用。我们如何才能利用这种功能?我想查阅一下菲尔德的资料。
发布于 2018-03-27 20:42:01
Doc注释不能通过dart:mirrors获得。
不过,您可以使用package:analyzer来访问它们。
https://stackoverflow.com/questions/49394855
复制相似问题