Go Router + Riverpod Examples
This repo contains a plethora of examples on how to integrate GoRouter and Riverpod altogether. These examples are community driven and strive to represent most of the solutions the community have found.
Every example in here is a simple mock of a login / logout logic. Feel free to create PR to introduce more examples.
NOTE. It is strongly encouraged to avoid the legacy
examples.
Special Thanks
BIG THANKS to @creativecreatorormaybenot for introducing a clever, yet simple way of handling GoRouter with Riverpod. Its contributions made possible to simplify (a lot!) the updated examples.
(legacy examples are still being showcased in a dedicated folder, as a migration steps for whoever)
Which example should I read or use?
I do realize there are a lot of examples right now. I've cleaned up the folders in here and I can tell you this:
- Try the
sync_router
folder first: that's a basic integration example with synchronous redirect - Then, read the
complete_example
folder and try that out. There's a lot going on there: enjoy.
Please consider starring this mini-repo if you found it useful. If you didn't, or if you want to contribute in any way, a discussion about improving this example can be found here.