navigate method

  1. @override
Future<void> navigate(
  1. T route
)
override

Navigates to a specific route, adjusting the stack accordingly.

If the route exists in the stack, pops back to it. If not, pushes the route onto the stack.

Implementation

@override
Future<void> navigate(T route) async {
  final routeIndex = stack.indexOf(route);
  if (routeIndex == -1) {
    // Route not found in IndexedStackPath - restore the URL to current state
    notifyListeners();
    return;
  }
  await activateRoute(route);
}