我想使用Smoke package,它在服务器端有效(无需在 Debug模式下使用转换器)。
在客户端,Polymer已经使用Smoke了,当我使用类似assert(sk.isSubclassOf(type, Message));
的方法时,它会失败,因为内部它会检查_parents
集合,并且它仅包含页面上使用的Polymer元素,而没有其他(纯Dart)类。
我如何初始化Smoke,以便它也识别其他类。
最佳答案
我在Polymer输入页面上使用自定义的main()
使其工作。
import 'package:smoke/mirrors.dart' as skm;
import 'package:polymer/polymer.dart';
void main() {
skm.useMirrors(); // worked on the server side without calling this method
initPolymer().run(() {});
}
关于dart - 如何初始化烟雾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26213204/