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 VM itself implement `eval` in `dart:mirrors` and developers use it. Are planned to make this method public?

Here is code that use this eval method in Dart platform. This is done via reflection. runtime/lib/mirrors_impl.dart _getFieldSlow(unwrapped) { // ..... Skipped var atPosition = unwrapped.indexOf('@'); if (atPosition == -1) { …
mezoni
  • 8,044
  • 4
  • 24
  • 42
0
votes
1 answer

I can not understand how to interpret the documentation on the Dart SDK mirrors library

In declaration of class "DeclarationMirror" I found these documentation about the "owner" property. For a `parameter`, `local variable` or `local function` the owner is the immediately enclosing function. I cannot understand how interpret this…
mezoni
  • 8,044
  • 4
  • 24
  • 42
0
votes
2 answers

What should be the output of the code below? Is this correct?

If I'm not wrong, this code should print: "dart.core.dynamic" but following is printed: "dynamic" My code: import 'dart:mirrors'; main() { var mirror = reflectType(dynamic); var symbol = mirror.qualifiedName; …
Tiago
  • 113
  • 5
0
votes
0 answers

how can i to instance an object by the classname in dart

i know there is a way to create objects in dart by the class names using dart:mirrors but i couldn't make it myself (I'm a beginner in dart), so please can anyone show me how to do it by an example ? the code i want to do is something like this…
Saïd Tahali
  • 171
  • 8
0
votes
2 answers

Dart JavaScript output fails with: method not found: 'new ToDos:1:0' Receiver: Instance of 'JsClassMirror'

I've ported a handy JS library to Dart: dartscale. The crucial part of it's functionality can be broken down to: final Map _registeredModules = new Map(); register(module, [String moduleName]) { final…
martyglaubitz
  • 942
  • 9
  • 20
0
votes
1 answer

ParameterMirror simpleName is Symbol("")

I'm trying to automatically map http query parameters to arguments in a function using mirrors. When I get the list of parameters the simple name for each param is Symbol("") I assume this means work in progress. Anyone know what the plans are for…
0
votes
2 answers

How do I get a ClassMirror on a Dart class?

How do I get a ClassMirror using the Mirrors API? I tried using the top level reflect() function, but that takes a class instance, not a class as an argument.
Shailen Tuli
  • 11,647
  • 5
  • 33
  • 46
0
votes
1 answer

Dart when to use the mirror API

This may be a silly question, so sorry for asking this, and fyi I'm new to this kind of stuff. After reading the documentation about mirrors, I can only grasp that the mirrors API is just like copying some instance plus access to some method that I…
Faris Nasution
  • 2,520
  • 4
  • 19
  • 26
0
votes
1 answer

Loading classes dynamically in Dart

So, I looked into mirror and they might be an option, but given their async nature they might be really awkward to use or just not viable in the long run. Since they are currently not supported (just a play-thing) they are not really viable at this…
srcspider
  • 10,171
  • 5
  • 35
  • 33
0
votes
2 answers

Is there an equivalent in Dart of the instance_variable_set method in Ruby?

If not, is there anything like this on the horizon? This is the one feature of JavaScript, Ruby, and Perl that I can't live without. I know you can fake it with a hash member, but I want to be able to create (arbitrary) "first class" members from a…
Jim Belton
  • 221
  • 2
  • 8
0
votes
1 answer

In Dart what is the generated name for a setter method?

If I have a class with a setter defined, how do I reference then generated method as a function from an instance of that class. The spec sort of suggests it would be the id of the variable + '=" (seems daft), but this doesn't parse. So for example:…
Richard
  • 173
  • 11
1 2 3
10
11