dartdart-mirrors

Access to type of DeclarationMirror


I need to access the type of DeclarationMirror. In the DeclarationMirror public API I can't see any method or property to access the type, but in Dartium, the DeclarationMirror missing property type is working and returning a ClassMirror with the type of the DeclarationMirror.

> declare is DeclarationMirror
< true
> declare.type
< ClassMirror on 'Logger'
> declare.type.reflectedType
< class Logger

Is safe using this way to get the type of DeclarationMirror?

If it is not safe, there is any other way safer to access it?


Solution

  • FYI: This was raised on github as well, and I think the responses given there resolved the issue.