switch pages without changing back flutter code example
Example: im going from first screen to second and from there to third but dont want to go back in flutter
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => MainPage()),
(Route<dynamic> route) => false,
);