Navigator to another without push history flutter code example

Example 1: 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 route) => false,
);

Example 2: flutter push and pop doesnt work

PROBLEM: flutter push and pop doesnt work

SOLUTION:
You are using MaterialApp more then one time in your project, you should only have one instance of MaterialApp 
as it holds your root configuration.

Ctrl + Shift+ F type MaterialApp Search and try to remove MatrialApp with Scaffold
you need to provide only one MaterialApp. And it shoud work...

Tags: