Milad-Akarie / auto_route_library

Flutter route generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No API to replace specified route.

623637646 opened this issue · comments

Let's say my current stack is A,B,C (A is the root page, C is the current page).
I want to replace A with D. So the stack should be changed to D,B,C.
Is this possible? I can't find an API to do this.
Flutter API Navigator support this by Navigator.of(context).replace(oldRoute: oldRoute, newRoute: newRoute)

Thanks for your quick response. I tried this before but encountered 2 more issues.

  1. The current stack is dynamic in my case, how can I get the current stack before passing to replaceAll([])? Thanks, this can work appRouter.stackData.map((e) => PageRouteInfo.fromMatch(e.route)).toList(). Is this the right way to do this?
  2. In my case. Some pages are pushed by flutter API Navigator.of(context).push(). Some pages are just from showDialog or showModalBottomSheet. In this case, if I do the replaceAll([]) things. The pages flutter API pushed still shows to the user and the interaction is confusing. That is why I want to replace the specified page instead of replaceAll to make others pages all good.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions