RouteEnterEvent e) {
  if (e.route.name != _currentName &amp;&amp; currentPath != e.path) {
    if (e.path != null &amp;&amp; e.path.isNotEmpty) {
      _currentName = e.route.name;
      currentPath = e.path;
      try {
        selectedPage = pages.firstWhere((item) =&gt; isSamePath(item.path, e.path));
        selectedPage.enterRoute(e);
        fire(page_changed_event, detail: selectedPage);
      } catch (e) {
        print(e);
      }
    } else {
      goToDefault();
    }
  }
}</code></pre>
    </se