How to initialize smoke

Issue

I want to use the Smoke package and it worked (without using a transformer just in debug mode) on the server side.

On the client side Smoke is already used by Polymer and when I use a method like assert(sk.isSubclassOf(type, Message)); it fails because internal it checks against the _parents collection and this contains only Polymer elements used on my page but none of my other (pure Dart) classes.

How do I initialize Smoke so it recognizes my other classes too.

Solution

I got it working using a custom main() for my Polymer entry page.

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(() {});
}

Answered By – Günter Zöchbauer

Answer Checked By – Marilyn (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.