json_to_dart icon indicating copy to clipboard operation
json_to_dart copied to clipboard

Allow generating code as a compiler tool

Open ghost opened this issue 7 years ago • 4 comments

any chance this can be adjusted so it functions as a tool at compile time ? a bit like other dart generators, where you point it to a directory and it generates the code for you.

you can still have it also work on the web too for.

ghost avatar Apr 28 '18 08:04 ghost

I'm not quite sure if that is possible, can you set up a hook in the dart compiler?

You can compile using a bash script that execute this library before the actual compile. You can check the example to see how would execute this as a standalone software.

javiercbk avatar Apr 28 '18 21:04 javiercbk

Yes you can do codegen in a more elegant way.

This is a great library doing just that using the standard dart codegen facilities https://github.com/davidmarne/built_redux/tree/dart-2-dev

ghost avatar Apr 30 '18 17:04 ghost

This is really interesting. I don't have much time to do that at the moment, but if anyone wants to contribute I'm more than willing to accept a PR.

javiercbk avatar Apr 30 '18 17:04 javiercbk

I finally figured out how to create a builder with this package. I might do it shortly, I might not. This so simple that it should be really easy for anyone to contribute to the project.

javiercbk avatar Dec 13 '19 12:12 javiercbk