goTo method

void goTo(
  1. SlickRoute path, {
  2. Object? extra,
})

Navigate to a specified route path, adding it to the stack

Implementation

void goTo(SlickRoute path, {Object? extra}) {
  GetIt.I<DirtyStateMonitor>().clearDirty();
  if (_navigationHistory.isEmpty || _navigationHistory.last != currentPath) {
    _navigationHistory.add(currentPath);
  }
  // Only add the current path if the route's `previousPath` is different
  if (path.previousPath != null &&
      path.previousPath?.location.normalizePath() != currentPath) {
    _navigationHistory.add(path.previousPath!.location.normalizePath());
  }
  goRouter.go(path.location, extra: extra);
}