You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the page API it is possible, you will be able to decide which return value you would like to pass in to each removed route by using transition delegate, see https://github.com/flutter/flutter/pull/50362/files#diff-c798125dc01f08ce6bd3a0931482078bR810. You will get to choose how route exit the route stack, and you can specify the result when you do that. This api will be surface with Router Widget where you should be able to specify transition delegate for the MaterialApp/WidgetApp/CupterinoApp. I hope this solve your use case, and there is currently no plan to update the existing popuntil api. Let me know if you have further question.
For more info place check out flutter.dev/go/navigator-with-router
I used pushNamedAndRemoveUntil Go back to the screen behind the one in question, and use arguments to pass your values. Better then trying to keep track of state.
I used pushNamedAndRemoveUntil Go back to the screen behind the one in question, and use arguments to pass your values. Better then trying to keep track of state.
That can work as a workaround, but it will use the push screen transition animation which could be confusing. Ideally we would want to keep using the pull animation to indicate that the user has actually gone back to a previous screen.
Revisiting this issue, Is the ask to return the same result for each route in the popuntil? that sounds like a dangerous api if one of them expect a different type of data. Seems to me it would be safer to call pop one by on
In my situation, I have "ListScreen" => "ItemScreen" with route settings name 'itemScreen' => "FirstModalBottomSheet" => "SecondModalBottomSheet" navigation queue. I do something via cubit in SecondModalBottomSheet, and have bloc listener in ItemScreen. In listener I call Navigator.of(context).popUntil((route) => route.settings.name == 'itemScreen') to navigate from SecondModalBottomSheet to ItemScreen and right after that Navigator.of(context).pop(resultType) to navigate back from ItemScreen to ListScreen with needed returned data. That is my solution
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
hungnt-kayac commentedon May 8, 2019
i have a workaround solution here. Hope that's useful for you
https://medium.com/@hungregistermail/flutter-popuntil-with-return-data-ece825aedbd0
Nico04 commentedon Aug 15, 2019
This article helped me a lot to find a workaround, thanks !
afi-mobile commentedon Feb 26, 2020
This thread was opened nearly a year ago. Is there any feedback on whether support is going to be added for adding a result to popUntil?
topnax commentedon Mar 2, 2020
I would really appreciate this feature as well. I have no clue why is this not implemented yet.
Nico04 commentedon Mar 2, 2020
It will be probably implemented with the new Navigator 2.0 ?
chunhtai commentedon Mar 3, 2020
With the page API it is possible, you will be able to decide which return value you would like to pass in to each removed route by using transition delegate, see https://github.com/flutter/flutter/pull/50362/files#diff-c798125dc01f08ce6bd3a0931482078bR810. You will get to choose how route exit the route stack, and you can specify the result when you do that. This api will be surface with Router Widget where you should be able to specify transition delegate for the MaterialApp/WidgetApp/CupterinoApp. I hope this solve your use case, and there is currently no plan to update the existing popuntil api. Let me know if you have further question.
For more info place check out flutter.dev/go/navigator-with-router
namchuai commentedon Apr 28, 2020
It's seems like an overkill but I'm using provider for this.
moneer-muntazah commentedon Jun 6, 2021
I used
pushNamedAndRemoveUntilGo back to the screen behind the one in question, and useargumentsto pass your values. Better then trying to keep track of state.elliotjd1 commentedon Oct 20, 2021
That can work as a workaround, but it will use the push screen transition animation which could be confusing. Ideally we would want to keep using the pull animation to indicate that the user has actually gone back to a previous screen.
rrifafauzikomara commentedon Mar 10, 2022
I fix it using shared_preferences, you can check the example and explanation here: https://stackoverflow.com/a/71426281/8291686
radiKal07 commentedon Mar 11, 2022
Very ugly for something that should've been provided out of the box by Flutter.
rrifafauzikomara commentedon Mar 13, 2022
Very agree but instead of you can't deliver that flow/feature in your app, why not? It's just a workaround until the Flutter team provide it.
Because I try this workaround did not work on my side, so I create one
Also this workaround I think will work too, but in my case I'm using BLoC / GetX, so can't use this workaround.
8 remaining items
EBBozkurt commentedon Aug 11, 2023
Is there any progress about this issue?
RenatoMoratto commentedon Sep 6, 2023
Any updates?
chunhtai commentedon Sep 6, 2023
Revisiting this issue, Is the ask to return the same result for each route in the popuntil? that sounds like a dangerous api if one of them expect a different type of data. Seems to me it would be safer to call pop one by on
RenatoMoratto commentedon Sep 6, 2023
In my case, I would like to return the result only in the last pop(). My goal here is to replace this code:
With something like this:
EBBozkurt commentedon Sep 6, 2023
I have the same situation, as @RenatoMoratto showed
Uvelir commentedon Apr 25, 2025
In my situation, I have "ListScreen" => "ItemScreen" with route settings name 'itemScreen' => "FirstModalBottomSheet" => "SecondModalBottomSheet" navigation queue. I do something via cubit in SecondModalBottomSheet, and have bloc listener in ItemScreen. In listener I call Navigator.of(context).popUntil((route) => route.settings.name == 'itemScreen') to navigate from SecondModalBottomSheet to ItemScreen and right after that Navigator.of(context).pop(resultType) to navigate back from ItemScreen to ListScreen with needed returned data. That is my solution
Add `Navigator.popUntilWithResult` (#169341)
Add `Navigator.popUntilWithResult` (flutter#169341)
github-actions commentedon Nov 12, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.Add `Navigator.popUntilWithResult` (flutter#169341)
Add `Navigator.popUntilWithResult` (#169341)