goToRoute method

void goToRoute(
  1. RoutePaths route, {
  2. Map<String, String>? params,
  3. Map<String, String>? queries,
  4. Object? extra,
})

Navigate to a route with validation

Implementation

void goToRoute(
  RoutePaths route, {
  Map<String, String>? params,
  Map<String, String>? queries,
  Object? extra,
}) {
  try {
    final path = (params != null || queries != null)
        ? route.pathWithParams(params ?? {}, queries: queries)
        : route.path;
    go(path, extra: extra);
  } catch (e) {
    if (kDebugMode) {
      debugPrint('Navigation error to ${route.path}: $e');
    }
    // Fallback to base path
    go(route.path, extra: extra);
  }
}