Home > Net >  How can I change navigator?
How can I change navigator?

Time:10-27

I have 3 pages, for example, I am on the first page. I go to the second page, and then to the third page. I click on the back button or system button and I want to get to the first page. I don't want to see the second page even if I press the system back button. How can I do this? Maybe clear the Navigator? I tried using

Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) => Single(value: _question))).then((value) => Navigator.pop(context));

But I see the second page for about a second and it closes.

CodePudding user response:

You can use Navigator.pushReplacement

This will help you if you wanna learn more details about navigator.

CodePudding user response:

You have the popUntil method on the Navigator. https://api.flutter.dev/flutter/widgets/Navigator/popUntil.html

That should all screens on the screen stack until the screen you choose to come back.

  • Related