openPopup method

String openPopup(
  1. String routeName,
  2. Map<String, String> param
)

Implementation

String openPopup(String routeName, Map<String,String> param) {
  // Cerca il path dal RouteRegistry usando il nome
  final registry = RouteRegistry();
  final String? pathFromRegistry = registry.getPathByName(routeName);
  if (pathFromRegistry != null) {
    // Sostituisci i parametri nel path
    String processedPath = pathFromRegistry;
    param.forEach((key, value) {
      processedPath = processedPath.replaceAll(':$key', value);
    });
    return processedPath;
  } else {
    // Fallback al comportamento originale
    final fullPath = GoRouterModular.routerConfig.namedLocation(
      routeName,
      pathParameters: param,
    );
    return fullPath;
  }
}