The purpose of the go_router for Flutter is to use declarative routes to reduce complexity, regardless of the platform you're targeting (mobile, web, desktop), handling deep linking from Android, iOS and the web while still allowing an easy-to-use developer experience.
There are times when we want to retrieve the .path value for a given route, using the name.
For example, I might have a view that need to check whether it is currently on the search page, but it only has the route name available to use.
So, given this route:
I want to check whether this is my current route somewhere down the tree, using
SearchPage.routeName
to do it: