'Flutter Navigator Observer get path of old and new route
I am trying to call an function, if the Router changes the first part of a Route. I do use a NavigatorObserver and know about the functions didPop/didPush.
I have the Routes like: "/page1", "/page2", "/page1/subpage1", "/page1/subpage2", "/page2/subpage1", "/page2/subpage1/subsubpage1".
When the the Router changes I want to know if I changed the page, regardless of the sub page. The functions give the old and new route a Route objects. But I can't figure out how to check these for the bottom route. I only managed to access the name of the page and to check if the Route is a first in the path. but that doen't help.
Does someone here know how I could get the complete path from the Route object or how else I could get it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|