Created
December 12, 2013 10:19
-
-
Save quietcricket/7925851 to your computer and use it in GitHub Desktop.
Instantiate a Class by String
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "dart:mirrors"; | |
MirrorSystem mirrors = currentMirrorSystem(); | |
LibraryMirror lm = mirrors.findLibrary(new Symbol('libraryName')); | |
ClassMirror cm=lm.declarations[new Symbol('ClassName')] as ClassMirror; | |
InstanceMirror im=cm.newInstance(const Symbol(''), []); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment