Set initial location for GoRouter based on web URL hash

This commit is contained in:
Leon Bösche
2026-01-25 18:37:01 +01:00
parent 2205536549
commit 904e909ce1

View File

@@ -16,8 +16,15 @@ import 'pages/public_file_viewer.dart';
import 'theme/app_theme.dart';
import 'injection.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:web/web.dart' as web;
final GoRouter _router = GoRouter(
initialLocation: kIsWeb
? (web.window.location.hash.isNotEmpty
? web.window.location.hash.substring(1)
: '/')
: '/',
routes: [
GoRoute(path: '/', builder: (context, state) => const HomePage()),
GoRoute(