csells / go_router

The purpose of the go_router for Flutter is to use declarative routes to reduce complexity, regardless of the platform you're targeting (mobile, web, desktop), handling deep linking from Android, iOS and the web while still allowing an easy-to-use developer experience.
https://gorouter.dev
441 stars 97 forks source link

GoRouter: refreshing /login #142

Closed nyck33 closed 3 years ago

nyck33 commented 3 years ago

I am using go_router with flutter_login: https://pub.dev/packages/flutter_login and Riverpod. I received some excellent advice on how to make Riverpod work with go_router here: https://github.com/rrousselGit/river_pod/issues/884 Everything seems to be working fine except I see in the console: Edit: To be updated with minimal reproducible example.

csells commented 3 years ago

Hey, @nyck33. Sorry you're having trouble. I don't think that this issue has anything to do with flutter_login or riverpod or most of the rest of app-specific code you've pasted into this issue. I'm going to ask that you rip out all of the code that isn't relevant and instead post a minimal repro case so that I can help you debug it.

nyck33 commented 3 years ago

@csells will do, thanks for chipping in.

nyck33 commented 3 years ago

I did some refactoring and the problem is gone. Basically the key was to change the state being watched by the ChangeNotifier as early as possible where as I was doing it as late as possible before.

chunghha commented 2 years ago

In case a help to someone, here is an example of how to handle login state in river_pod's StateNotifierProvider for routing with go_router. Also, a migration from beamer to go_router.

nyck33 commented 2 years ago

@chunghha is it deeply-linked and also works in a browser (Flutter-web)? I am looking for deeply-linked tabs and both go_router and routemaster have problems out-of-box.

csells commented 2 years ago

I did some refactoring and the problem is gone.

Glad to hear it!