Ad

I Want To Open New Screen, But Without The Putting The Screen Above The Screen, Is That Possible In Flutter?

- 1 answer

I want to open a new screen in flutter app , but without the putting the screen above the screen I mean like any normal website routing pages with back button for previous page.

Ad

Answer

Navigator.of(context)
    .pushNamedAndRemoveUntil('/login', (Route<dynamic> route) => false);

This will remove all the previous routes before pushing the new screen

If you want only remove the last page, then you can use this:

Navigator.of(context)
    .pushReplacementNamed('/login');
Ad
source: stackoverflow.com
Ad