Search code examples
dartdart-mirrors

Is there a way to get the annotation on a class using Smoke?


Is there a way to get the annotation on a class using Smoke?

class Anno {
 const Anno();
}

@Anno
class A {
}

void main() {
  var a = new A();
  // how to get the annotation `@Anno` from `a` using the Smoke library
  someMethod(A);
}

var someMethod(Type t) {
  // get the annotation `@Anno` from `t` using the Smoke library
}

Solution

  • There is not currently any support for reading annotations in Smoke :(

    You could raise an issue at dartbug.com, though I don't know whether it's likely the Polymer team will add functionality not required by Polymer (my case hasn't had any useful response) :(