When I use Flutter Navigator.pushNamedAndRemoveUntil , How to listen for jumps?

Viewed 1719

strong text Navigator.pushNamedAndRemoveUntil(context, "/tabs", (Route route) => false);

1 Answers

If you want to remove all the previous pages navigated from the stack you should use this

Navigator.pushNamedAndRemoveUntil(context, "/tabs", (Route route) => route.isFirst);

Or if you want to pop to a specific page

Navigator.pushNamedAndRemoveUntil(context, "/tabs", (Route route) => route.settings.name == 'homePage'); //replace with where you want to pop to

Then the newly pushed page will become the first page in navigation stack

Related