1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Navigating Users Between Pages Without Allowing Back Navigation

Discussão em 'Mobile' iniciado por Stack, Outubro 9, 2024 às 10:22.

  1. Stack

    Stack Membro Participativo

    GoRouter: How to navigate to the home page after login and prevent back navigation to the login page in Flutter (Web and Mobile)

    I am building an e-commerce app for both web and mobile using Flutter, and I'm using the GoRouter package for routing. When the user logs in, I want to navigate them to the home page (/home) and prevent them from navigating back to the login page (using the back button or browser back action on the web).

    Here is what I've tried so far:

    After verifying the login credentials, I used context.replace('/home'); in the onTap method of my sign-in button to navigate to the home page. However, the issue is that users can still navigate back to the login page using the browser's back button or the device's back button. What I'm looking for:

    A solution that ensures users cannot navigate back to the login page once they are successfully logged in.

    Continue reading...

Compartilhe esta Página