Set initial location for GoRouter based on web URL hash
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user