Dart API Referencedart:mirrors

dart:mirrors library

The mirrors library provides basic reflection support for Dart. Reflection here is limited to introspection and dynamic evaluation.

Introspection is that subset of reflection by which a running program can examine its own structure. For example, a function that prints out the names of all the members of an arbitrary object.

Dynamic evaluation refers the ability to evaluate code that has not been literally specified at compile time, such as calling a method whose name is provided as an argument (because it is looked up in a database, or provided interactively by the user).

How to Interpret the Dartdoc specifications below

As a rule, the names of Dart declarations are represented using instances of class Symbol. Whenever we speak of an object s of class Symbol denoting a name, we mean the string that was used to construct s.

We will also frequently abuse notation and write Dart pseudo-code such as o.x(a), where we have defined o and a to be objects; what is actually meant in these cases is o'.x(a') where o' and a' are Dart variables bound to o and a respectively. Furthermore, o' and a' are assumed to be fresh variables (meaning that they are distinct from any other variables in the program).

An object is serializable across isolates if and only if it is an instance of either num, bool, String, a list of objects that are serializable across isolates or a map whose keys and values are all serializable across isolates.

Functions

ClassMirror reflectClass(Type key) #

Returns a ClassMirror for the class represented by a Dart Type object.

This only works with objects local to the current isolate.

external ClassMirror reflectClass(Type key);

InstanceMirror reflect(Object reflectee) #

Returns an InstanceMirror for some Dart language object.

This only works with objects local to the current isolate.

external InstanceMirror reflect(Object reflectee);

Future<MirrorSystem> mirrorSystemOf(SendPort port) #

Creates a MirrorSystem for the isolate which is listening on the SendPort.

external Future<MirrorSystem> mirrorSystemOf(SendPort port);

MirrorSystem currentMirrorSystem() #

Returns a MirrorSystem for the current isolate.

external MirrorSystem currentMirrorSystem();

Abstract Classes

Classes

Exceptions