How to run code generator like @riverpod, @json_serializable etc, on generated code?

43 Views Asked by At

I have many Models such as Customer, Vendor, Employee for which Riverpod provider and notifier gets generated via @riverpod code generator.

My problem is that i have to write repetative code in providers of all model Types.

I just copy file and replace "Customer" with "Employee" or any other model, on which i just need to run build_runner for @riverpod to generate notifiers and providers.

My question is if there is a way to chain this process, such that i would annotate a class with @myCustomGen which would generate code for all model types and all of it would go inside @riverpod generator to give final generated code.

For a note this question is similer to - How to run a code-generator on the top of another code-generator?

But i am unable to follow the solution given there. If someone can provide a complete example that would work for me.

Thanks

0

There are 0 best solutions below