See NavigationHistory.isPathActive
NavigationHistory.isPathActive
bool isPathActive(String path) { return navigationHistory.isPathActive(path); }