My aplogoze for the original question. I'm getting confused. This is my actual question.
I have a situation where I need to use some defined classes as an object of type Type
and instantiate it's object instance. As for now, I'm using self defined static instantiator function to call the constructor and it's working good. So I can just call Function.apply()
to create an object. Rather than doing that, is there any way I can use the class's Type
to emulate the class's constructor.
What have I tried? They say to use Mirror
, a solution for Dart's reflection.
import 'dart:mirrors'
have failed with error
Target of URI doesn't exists
Or at least if it's not ready provided I don't know where to get the package.
import 'package:reflectable/mirrors.dart'
with package from git://github.com/dart-lang/reflectable.git only defines all Mirror
implemented classes, but function reflect
is missing.