go_router
for navigation and route protection based on authentication state. This guide demonstrates how to set up go_router with Dynamic authentication flows.
AuthNotifier
that bridges Dynamic SDK streams into a ChangeNotifier
that go_router can use to automatically handle route redirects based on authentication state.
AuthNotifier
class that listens to Dynamic SDK authentication streams:
AuthNotifier
and route protection:
main()
function:
AuthNotifier
manages three distinct states:
AuthPhase.loading
: SDK is initializing or user state is being determinedAuthPhase.unauthenticated
: SDK is ready but no user is authenticatedAuthPhase.authenticated
: SDK is ready and user is authenticated