Search code examples
flutterdartnavigationmaterialpageroute

Flutter/Dart - Navigator.pop(context) - How to Pop two Contexts back?


I've got;

  • screen/widget Home() which calls;

  • screen/widget MainStage() which calls;

  • future method futureStage() which builds;

  • PageViewBuilder StageBuilder() which contains;

SwipeGestureRecognizer which calls;

Navigator.push (context,
                  PageTransition(
                    type: PageTransitionType.downToUp,
                    child: HomeReply(),
                  ));
  • HomeReply() contains;
  • appBar with an arrow/button that allows the user to;
  • Navigator.pop(context);

How do I get the Navigator to pop back to Home()?


Solution

  • Turns out HomeReply() had an extra MaterialApp in the build. Once I removed this it all worked as normal with Navigator.pop(context);.