0

I am iterating over my libraries declarations using mirrors so I can read the meta data on my classes. But I need to get the actual type of the declaration I'm currently on, but I don't see a way to do this in the api docs.

var decs = myLibraryMirror.declarations;
decs.forEach((symbol, dec){
  dec.metaData.forEach((metaMirror){
    var meta = metaMirror.reflectee;
    if(meta is TheTypeImInterestedIn){
      // do some stuff with the meta object and the class Type it's declared on
      // but how to get the Type of the class that the declaration refers too?
    }
  });
});
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Daniel Robinson
  • 13,806
  • 18
  • 64
  • 112
  • http://stackoverflow.com/questions/24111378/refer-classes-by-their-metadata-tag – JAre Dec 21 '14 at 22:27
  • not an exact duplicate, the answer to this question is: The DeclerationMirror IS A ClassMirror (in the cases where it is) so you may just cast (or not) and use `dec.reflectedType` to get the class Type in question. – Daniel Robinson Dec 21 '14 at 23:00

0 Answers0