No API to replace specified route.
623637646 opened this issue · comments
Yanni Wang 王氩 commented
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)
Milad Akarie commented
You can rearrange your stack and pass it to replaceAll([])
Access stack router.stackData
…On Tue, Jun 21, 2022, 2:02 PM Yanni Wang 王氩 ***@***.***> wrote:
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)
—
Reply to this email directly, view it on GitHub
<#1122>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANECH6LNSJIDSZYAEK6LFMDVQGON7ANCNFSM5ZL5GCEQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
Yanni Wang 王氩 commented
Thanks for your quick response. I tried this before but encountered 2 more issues.
The current stack is dynamic in my case, how can I get the current stack before passing toThanks, this can workreplaceAll([])
?appRouter.stackData.map((e) => PageRouteInfo.fromMatch(e.route)).toList()
. Is this the right way to do this?- In my case. Some pages are pushed by flutter API
Navigator.of(context).push()
. Some pages are just fromshowDialog
orshowModalBottomSheet
. In this case, if I do thereplaceAll([])
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.
github-actions commented
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