I made an app that pushes a route to the navigation stack for every route. It was because my clients required to go back a few pages for their use case ie. fill a form, navigate somewhere else and to add new data and come back to the form. It works as expected but the app now stores a lot of pages on the stack. How do I go about limiting it to say 4 routes in the stack max, while the last one gets removed?
I tried using context.go("route")
but that clears the whole stack and not just a few. I see an answer for limiting the stack but it does not use go_router