Umesh Chakradhar
Umesh Chakradhar

Reputation: 189

How to pop page till desired page in flutter

I have multiple pages in flutter

let:

Page A opens Page B,

Page B opens Page C,

Page C opens Page D.

i have not popped any of pages

now on any user interaction i want to navigate to page A from page D. how can i do that??

My question is somewhat similar to this question : click here

the only option i know is using multiple pop.

  Navigator.of(context).pop();

Upvotes: 1

Views: 687

Answers (1)

Iosif Pop
Iosif Pop

Reputation: 382

You can use pushNamedAndRemoveUntil or pushAndRemoveUntil.

Navigator.of(context).pushNamedAndRemoveUntil(
      '/d-route', (Route<dynamic> route) => false);

Upvotes: 2

Related Questions