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.
CodePudding user response:
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');