Navigation.of.pop context code example

Example 1: flutter push route

// Within the `FirstRoute` widget
onPressed: () {
  Navigator.push(
    context,
    MaterialPageRoute(builder: (context) => SecondRoute()),
  );
}

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:

Dart Example