Tuesday 15 June 2010

dart - How do I access metadata annotations from a class? -


I have a dart class that is annotated with metadata:

  class horrible {last string msg; Const wonderful (this.msg); String toasting () = & gt; message; } @ Avenom ('this works!') Class {}   

I have to see if cool is annotated, and if so So, what will happen if I do this?

to use dart: mirror library metadata annotation.

  import 'dart: mirror'; Class awesome (last string msg; const too great (this.msg); string toasting () => message;} avand ('this works!') Class cool {} void main () {classmiller class mirror = Reflector (cool); InstanceMirror & gt; Metadata = Class Mirror Metadata; Var obj = Metadata of the list; Fast. Reflexive; Print (obj); // This works!}   



No comments:

Post a Comment