/** * Path-based URL strategy for Flutter Web * * This script enables path-based routing (without hash fragments) by calling * the Flutter framework's URL strategy before the app starts. * * This is the JS equivalent of UrlPathStrategy.setPathUrlStrategy() * and is required for clean URLs like /services instead of /#/services */ // Set up push state management before Flutter loads // This ensures path-based routing works even if the Dart side fails (function() { // Set up push state management before Flutter loads window.addEventListener('flutter-first-frame', function() { console.log('[PSEI] Flutter first frame detected, path routing active'); }); // Register the URL strategy callback that Flutter looks for // When Flutter detects this function, it calls it to configure path routing // The callback receives a JsRouteConfiguration object with setPathUrlStrategy() window.flutter_web_js_route_callback = function() { console.log('[PSEI] Path-based routing enabled via JS callback'); return function(config) { config.setPathUrlStrategy(); }; }; })();