normalizeRoute static method

String normalizeRoute(
  1. String route
)

Normalizes a route to ensure it starts with a forward slash.

Implementation

static String normalizeRoute(String route) {
  if (route.isEmpty) {
    return '/';
  }

  // Remove leading slash if present
  String normalized = route.startsWith('/') ? route.substring(1) : route;

  // Add leading slash back
  return '/$normalized';
}