marcglasberg / async_redux

Flutter Package: A Redux version tailored for Flutter, which is easy to learn, to use, to test, and has no boilerplate. Allows for both sync and async reducers.
Other
230 stars 41 forks source link

Boilerplate generator #132

Closed hummy123 closed 2 years ago

hummy123 commented 2 years ago

Hi there,

This is a cool package. I migrated to this from flutter_redux and appreciate the simplicity in writing reducers. It takes a lot less time and cleans up my file structure quite a bit. I also appreciate how quickly it migrated to Flutter 3.0.

Anyway, I made a very simple boilerplate generator (need to expand on it when I have time) for this package.

The generator just creates files containing the outlines of a Connector, Vm, Factory and a Pure Widget and save them in a file to reduce repetitive typing. It's very simple.

You shouldn't expect it to know that a function parameter shouldn't be added to the equals parameter list, for example., but it should save time for anyone who uses it.

It automatically implements/encourages the connected widget pattern as well, to help maintainability and good design.

Here is the link: https://async-redux-generator.herokuapp.com/ .

If my simple generator can get a shout-out in the readme, that would make me happy, but I understand people are likely to think "if this is Redux without the boilerplate, why do I need a code generator?". I was just tired of repeating the steps: create connector -> create Vm -> create factory -> connect to widget.

Have a nice day, Humza

marcglasberg commented 2 years ago

Hi Humza,

I think this is a very good idea, but not as an external generator. In IntelliJ we have "Live Templates" to do something similar. Or I was also thinking of building an IntelliJ plugin that could do that. Do you use IntelliJ?

hummy123 commented 2 years ago

Thanks for the prompt response Marc. I think you are right that an IDE plugin would be better if possible.

I'm not 100% sure if an Intellij plugin can take input such as parameter names/types to add in the appropriate places (like the ViewModel), but that might be my lack of experience speaking as I am mainly thinking of the flutter_bloc plugin for Intellij. I'll try taking a look at plugin capabilities.