문제

I have a function and want to get its docblock with mirrors. Do mirrors already support that?

도움이 되었습니까?

해결책

If you mean comments when you say "DocBlock" or something like javadoc-style comments like:

/**
 * Comment
 */

// Comment

Then this is not possible.

But you can create Annotations and use this as a doc:

@Doc("Some Documentation")
class SomeClass {

}

TypeMirror tm = reflectType(SomeClass );

print((tm.metadata.first.reflectee as Doc).string);

But I guess this is not what you are looking for?

There is a Comment class in dart:mirror - but note that it is not used and dart:mirror is officially "unstable".

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top