Skip to content
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

Open
xxgreg opened this issue Apr 23, 2015 · 10 comments
Open

Documentation for mirrors, dart2js and the @mustache annotation #19

xxgreg opened this issue Apr 23, 2015 · 10 comments

Comments

@xxgreg
Copy link
Owner

xxgreg commented Apr 23, 2015

No description provided.

@xxgreg
Copy link
Owner Author

xxgreg commented Apr 23, 2015

@MikeMitterer

Added this so I remember to update the docs with an example.

@e-belair
Copy link

e-belair commented Dec 6, 2019

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?

[WARNING]build_web_compilers:entrypoint on web/main.dart: Skipping compiling my_app_web|web/main.dart with ddc because some of its
transitive libraries have sdk dependencies that not supported on this platform:

mustache|lib/src/renderer.dart

@xxgreg
Copy link
Owner Author

xxgreg commented Dec 6, 2019

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.
https://pub.dev/packages/reflected_mustache I'm not sure if that's being maintained or not.

@e-belair
Copy link

e-belair commented Dec 9, 2019

How do I remove these lines of code after installed the package via pubspec ? Do I need to fork the project to do this?

@xxgreg
Copy link
Owner Author

xxgreg commented Dec 9, 2019

Yup. You can fork it, and then add it to your pubspec using a git dependency.

https://flutter.dev/docs/development/packages-and-plugins/using-packages#dependencies-on-unpublished-packages

Hopefully I'll find time to add this support for AOT/js. But merge requests are also always welcome.

@e-belair
Copy link

Why not using reflectable as the other libs?

@xxgreg
Copy link
Owner Author

xxgreg commented Dec 10, 2019

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.

@e-belair
Copy link

I was talking about mustache_reflectable. For instance, I'm using it because I already use reflectable in my project.
Anyway, thank you for your help, and if I have enough time ... one day .... would be a pleasure to help

@lloy0076
Copy link

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?

@xxgreg
Copy link
Owner Author

xxgreg commented Jan 24, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants