-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation for mirrors, dart2js and the @mustache annotation #19
Comments
Added this so I remember to update the docs with an example. |
Hi, I get the following error after I've installed the package. I don't know how to make it work, could you provide a real working example, please?
|
If you're planning on using this with dart2js or flutter you'll need to remove the code which uses mirrors. The dart:mirrors package is now only supported by the VM running in JIT mode. See _getNamedProperty() in renderer.dart. This should require commenting out a few lines, and the dart:mirrors import. Then using maps rather than objects as input. I'd like to add another entry point to the library to allow using this package as is with dart2js and AOT, but I haven't found the time. I'd happily take a contribution. There's also a forked version which uses the reflectable package for code generating the mirrors code. |
How do I remove these lines of code after installed the package via pubspec ? Do I need to fork the project to do this? |
Yup. You can fork it, and then add it to your pubspec using a git dependency. Hopefully I'll find time to add this support for AOT/js. But merge requests are also always welcome. |
Why not using reflectable as the other libs? |
Which other libs? I'd rather not bake in a dependency on reflectable, but rather let the user of the library choose. I'd like to make it easy for end user to plug the libraries together with whichever library they use. |
I was talking about mustache_reflectable. For instance, I'm using it because I already use reflectable in my project. |
Just out of morbid interest, is there a particular reason why this doesn't use something that doesn't work through more the of the whole Dart ecosystem? |
It was built before flutter and dart2native existed. At the time it worked with both dart2js and the VM, which was the entire ecosystem. AOT exists now, and dart2js no longer supports mirrors, so some work is required to make the library work with these targets. Somebody should definitely do this. It's not much work. |
No description provided.
The text was updated successfully, but these errors were encountered: