go_router_riverpod
go_router_riverpod copied to clipboard
Use GoRouter.refreshListenable
GoRouter can get a listenable and refreshes if the listenable notifies the router. In your code you are not using it, but I think it would be the better way to do it. You are listening to the current auth state and rebuild the whole router on a change. The state remains intact because of the global key, but this is probably more expensive than creating a listenable and let GoRouter refresh itself.
Thank you for raising this issue. It was not intended to rebuild the whole router provider, so I'm guessing I wrote a ref.watch
instead of a ref.listen
.