Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

go_router - how to push a page over existing pages in stack (in any path)

I use go_router for navigation handling in my project. I have an invoice page, and I want to show this page after payment is done over existing pages on navigation stack.

For example, if the user is in /detail/book, /profile/job, or whatever path, I want to push that invoice page over all of my route paths with a back button on it to get back to the previous page.

I tried doing this manually with Navigator 2, but I don't know how to do it with Go Router.

like image 630
Mohamamdreza Siahpoosh Avatar asked Nov 30 '25 17:11

Mohamamdreza Siahpoosh


1 Answers

Per the go_router documentation context.go('route') navigates to route by replacing stack of views context.push('route') navigates to route by adding view to the stack which can be removed by the back button you want with context.pop()

like image 185
CStark Avatar answered Dec 02 '25 06:12

CStark