flutter navigator back to a page without history 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,
);