I have this annotation
class Target{
final String value;
const Target(this.value);
}
and 2 classes that are annotated with it
@Target("/313")
class c1{
}
@Target("/314")
class c2{
}
how can i get a List of ClassMirror
instances for the classes that have the Target annotation?
based on the selected answer that is if i knew what library my calsses exist in
var mirrorSystem = currentMirrorSystem();
var libraryMirror = mirrorSystem.findLibrary(#testlib);
for(ClassMirror classMirror in libraryMirror.declarations.values){
if(classMirror.metadata!=null){
for(var meta in classMirror.metadata){
if(meta.type == reflectClass(Path)){
print(classMirror.simpleName);
print(meta.getField(#value));
}
}
}
}
This searches all libraries in the current isolate for classes that are annotated with
@Target('/313')