For the latest Dart news, visit our new blog at https://medium.com/dartlang .
Posted by Gilad Bracha First-class Types in Dart Currently Dart does not provide any access to types as objects at the base level. We propose to provide a getter on class Object : @native Type get type; which returns a reified representation of the class of an object. Note that the method type can be overridden in subclasses (for example, to implement a remote proxy that hides its implementation). The declaration of class Type is class Type { @ native String toString(); String descriptor(){...} // return the simple name of the type } In other words, Type does not add any API to Object, other than the ability to get its name. One can use toString() to obtain a description of the type (such as its name), one can test types for equality or identity, one can hash them (assuming we move forward on making all objects hashable) and that is all. The main use of these reified types is to serve as keys to the mirror system. Instances of Type are canonicalized. An identifier t