Questions tagged [dart-mirrors]

Dart Mirrors lets you reflect objects with an API that is based on the concept of mirrors.

Dart Mirrors lets you reflect objects with an API that is based on the concept of mirrors.

To use reflection on an object, you need to get a mirror for it first.

An introducion into Dart Mirrors.

dart:mirrors library

161 questions
0
votes
1 answer

Dart mirrors reflectss Comments?

In the mirrors.dart source, you can find this: /** * Class used for encoding comments as metadata annotations. */ class Comment { /** * The comment text as written in the source text. */ final String text; /** * The comment text…
Nico Rodsevich
  • 1,835
  • 2
  • 19
  • 28
0
votes
1 answer

Access to type of DeclarationMirror

I need to access the type of DeclarationMirror. In the DeclarationMirror public API I can't see any method or property to access the type, but in Dartium, the DeclarationMirror missing property type is working and returning a ClassMirror with the…
Ivan Montilla
  • 314
  • 3
  • 16
0
votes
1 answer

How do you access multiple mixins via reflection in Dart?

Here's the simplest example. class MixA{ } class MixB{ } class Base{ } class MyClass extends Base with MixA, MixB{ } main(){ var m = new MyClass(); reflect(m).superclass.mixin; //This only gives MixB. Is there a way to get a list of all the…
mfrancis107
  • 1,381
  • 1
  • 12
  • 21
0
votes
1 answer

Relevance of @MirrorsUsed, Smoke annotation when using reflection in Dartium

I have fairly significant application written with Dart and Polymer which uses reflection in a factory method and runs fairly well in Dartium. The factory generates subclass instances using the subclass name passed to it as a parameter. I'm fine…
Tom Russell
  • 949
  • 1
  • 8
  • 24
0
votes
0 answers

How are arguments passed into the parameter list of ClassMirror.newInstance(...)?

I wrote the following (working) code and would now like to add an "octave" parameter to the constructor call for Animal subclasses, I guess so that when a new animal is created, the studio can make make appropriate adjustments. Or something. It's…
Tom Russell
  • 949
  • 1
  • 8
  • 24
0
votes
1 answer

What is the format of the "arguments" parameter to ClassMirror.newInstance()?

I'm perfectly willing to play with this until I get it right, but was hoping someone might give me a hint. The parameter is declared in the docs (gen-dartdocs/dart-mirrors/ClassMirror/newInstance.html) as InstanceMirror newInstance(Symbol…
Tom Russell
  • 949
  • 1
  • 8
  • 24
0
votes
1 answer

Can I reflect HTML libraries in the stand-alone Dart VM?

I'm trying to do code generation in the following way: a view is defined in an XML markup, the tags refer to components that are part of a library which imports dart:html. Ideally, I would like to run a vm script (i.e. via a transformer) which…
0
votes
0 answers

How can I get the Type from a DeclerationMirror in Dart

I am iterating over my libraries declarations using mirrors so I can read the meta data on my classes. But I need to get the actual type of the declaration I'm currently on, but I don't see a way to do this in the api docs. var decs =…
Daniel Robinson
  • 11,116
  • 12
  • 52
  • 92
0
votes
0 answers

How do I get an actual object dynamically in Dart?

Tl; dr: I get the class symbol and arguments dynamically, how do I get the object and not some mirror thingy. Hi, I have a situation where I get the symbol (or string) of a class name and the arguments (maybe positional, maybe optional positional,…
wellnoidea
  • 193
  • 9
0
votes
2 answers

dart reflection call by String

I want to wrote method which call all function in class: class Example extends MyAbstractClass { void f1(){...} void f2(){...} void f3(){...} Example(){ callAll();//this call f1(), f2() and f3(). } } I have problem in this part of…
0
votes
1 answer

Future of mirrors in Dart

I am developing an app in Dart and I plan to support dynamically loaded plugins. I can't do this in mirrors as it does no support instantiating classes from external sources, listing classes from external files etc. Do you plan to extend mirrors to …
Skoky
  • 779
  • 1
  • 8
  • 15
0
votes
1 answer

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…
Günter Zöchbauer
  • 490,478
  • 163
  • 1,733
  • 1,404
0
votes
1 answer

Create an instance of an Generic Class from a String in Dart?

Hello from here I know that I can create an instance from a String: How to get a Class name dynamically (from a string) in Dart, then create an instance? but How do I create an instance of a Generic class from a String, ie: var class_name =…
Luis Vargas
  • 2,146
  • 1
  • 12
  • 27
0
votes
1 answer

Is it possible to list a Dart class's parameters using dart:mirrors?

Let's say that I have a class Person defined like this: class Person { String name; Person(this.name}; } Is there any way to acquire a list of the class Person's parameters using dart:mirrors. Basically, I'm working on a library that involves…
lucperkins
  • 628
  • 1
  • 7
  • 14
0
votes
2 answers

Dart mirrors issue. getField

I'm trying use mirrors, but I have error in some simple code. import 'dart:mirrors'; // ----------------- class TestUser extends Object{ String name = 'aaa'; String status = 'bbb'; String position = 'ccc'; int age = 20; } var mapVal = new…
1 2 3
10
11