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
{{ message }}
Repository navigation
Update API docs to include example of how to get current Route #14243
@xster I picked this up, it seemed a simple enough solution to expose NavigatorState's _history.last property with a getter. Did you have something else in mind?
Hi In my Case in a chat app , the user should get a notification for all the messages on the screen except the active chat, So I have to check if the current route is equal to the notification I received, if so ignore else show.
Reacted by Luca Romagnoli, Ludwik Trammer, Jonathan White, tz, mirkancal, JinG, Rami Mohamed, Matthew Nguyen, Lucio, J. Deng and 25 more
Any updates on this, Need this as I have exactly the same use case as @vmwsree has mentioned above.
But in addition to not show notification for the active chat, I also want to cancel all the notifications if chat-app home screen (list of all chat) widget is visible in the viewport. @xster@zoechi
Any work around for time being is appreciated. Thanks!!
Rather than title saying Document how to get current Route, I don't think there is a feature to fetch the current route or its type, this is a framework requirement
@tmushayahama This issue is just about updating the API docs. If you have a use case that is not currently handled, I encourage you to file a new bug. If you would like to help us, then you are welcome to do so; Flutter is an open source project.
@Saad29 That's a PR for a different issue (it doesn't change the documentation), and it looks like Victor decided not to follow it up. You are, however, welcome to file a bug that describes the use case you want to address and then you are welcome to use that PR as the start of a patch to address your use case.
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
xqwzts commentedon Jan 26, 2018
@xster I picked this up, it seemed a simple enough solution to expose NavigatorState's
_history.lastproperty with a getter. Did you have something else in mind?xster commentedon Jan 26, 2018
@Hixie may have some existing mental picture of what he wants to do
Hixie commentedon Jan 29, 2018
Can you elaborate on the use case here? Why is
ModalRoute.of(context).isCurrentsufficient, for instance?xster commentedon Jan 29, 2018
I think it is. Might just be a matter of documentation and convenience.
sroddy commentedon Jan 29, 2018
What if the route is not a ModalRoute and the widget can be added in different routes?
Hixie commentedon Jan 30, 2018
Can you give an example?
How would you use the new API? (e.g. how would you be notified if the current route changed, or if the current widget was moved to another route?)
[-]Add a current() API to NavigatorState[/-][+]Document how to get current Route[/+]vmwsree commentedon Feb 9, 2019
Hi In my Case in a chat app , the user should get a notification for all the messages on the screen except the active chat, So I have to check if the current route is equal to the notification I received, if so ignore else show.
dspoonia7 commentedon Feb 25, 2019
Any updates on this, Need this as I have exactly the same use case as @vmwsree has mentioned above.
But in addition to not show notification for the active chat, I also want to cancel all the notifications if chat-app home screen (list of all chat) widget is visible in the viewport.
@xster @zoechi
Any work around for time being is appreciated. Thanks!!
vmwsree commentedon Feb 26, 2019
Rather than title saying Document how to get current Route, I don't think there is a feature to fetch the current route or its type, this is a framework requirement
Ikxyz commentedon Mar 2, 2019
To get the exact route name eg /home use
import 'package:path/path.dart';ModalRoute.of(context).settings.name@xster @zoechi @vmwsree
41 remaining items
tmushayahama commentedon Nov 22, 2022
November 2022 and 4 years later no resolution to this. I thought this was a common functionality in most frameworks,
[-]Document how to get current Route[/-][+]Update API docs to include example of how to get current Route[/+]Hixie commentedon Nov 24, 2022
@tmushayahama This issue is just about updating the API docs. If you have a use case that is not currently handled, I encourage you to file a new bug. If you would like to help us, then you are welcome to do so; Flutter is an open source project.
@Saad29 That's a PR for a different issue (it doesn't change the documentation), and it looks like Victor decided not to follow it up. You are, however, welcome to file a bug that describes the use case you want to address and then you are welcome to use that PR as the start of a patch to address your use case.
github-actions commentedon Apr 6, 2023
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.