Helps finding classes or methods with specific annotations.
Dart Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
LICENSE
pubspec.lock
pubspec.yaml
readme.md

readme.md

Annotation Crawler

Build Status

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); 

    }