annotation_crawler 0.1.0
annotation_crawler: ^0.1.0 copied to clipboard
Helps finding classes or methods with specific annotations.
Annotation Crawler #
Helps finding annotated declarations in a particular scope.
Usage #
import "annotation_crawler";
main () {
//perform all plays written by Arthur miller
annotatedDeclarations(Author)
.where((decl) => decl.declaration is ClassMirror && decl.annotation == const Author("Arthur Miller"))
.map((decl) => decl.declaration.newInstance(const Symbol(""), ["Her majesty's Theater"]).reflectee)
.forEach(perform);
//Perform the first scence of ACT III of the Merchant of Venice
var play = annotatedDeclarations(Title)
.where((decl) => decl.annotation.name = "The Merchant of venice")
.single.newInstance(const Symbol(""), ["Her majesty's theater"]);
MethodMirror scene = annotatedDeclarations(Scene, on: play.runtimeType)
.where((decl) => decl.annotation.act == "III" &&
decl.annotation.scene == "I")
.single;
perform(play.getField(scene.simpleName).reflectee);
}
