A restricted reflection system with mirrors on development-time, and pre generated mirrors on runtime. It only reflects classes and its methods and fields with Metadata This reflective system is tuned for speed on the deployment.




Mist is a package that exposes a reduced reflective to reflect classes. It should give you better performance on deploy mode then mirror based reflection (not benchmarked yet). However, first and foremost it should make it easier to build a better reflection solution then mark everything that needs to be reflected with [MirrorsUsed][] annotation.

Each package that has classes that needs to be reflected need the default mist Transfromer in the pubspec (e.g - mist)

Mist uses darts default mirror reflection on developmenttime and its own generated implementation on deploy.

It can only Reflect classes and its fields and methods. Excluding operators, getters/setters, non default constructors and no arguments for it (only MyClass()) and not metadata on parameters on methods. It supports private members but does not include members that are not defined in the reflectedclass (unless its a subclass of a reflected class)

classes that need to be reflected needs to be marked with: @MistReflect() If subclasses needs to be reflected to you mark the class like this: @MistReflect(includeSubclasses: false)

Use @Ignore() to exclude certain field or method from reflection.

Mist API

Use package:mist/mist.dart in your framework and use:

/// Returns a List of all Subclasses of Class with runtimeType [type]
List<ClassInfo> getAllSubclassesInfoOf(Type type);

/// Returns reflected classInfo of class with runtimetype [classType]
ClassInfo getClassInfo(Type classType);

Transformer usesage

Libs that include reflectable Classes have to include the mist Transformer in their pubspec: transformers:

  • mist

For applications you need to include this in your pubspec:


  • [mist,mist/src/build/generic_static_gen,$dart2js] Node: To create a custom static reflections Transformer you need to replace mist/src/build/generic_static_gen

Code Generation

Use package:mist/generator/mistgen.dart in your frameworks Transformer to generated the static initialization when running with generated sourcecode instead of darts mirror based reflection.