I would like to create a workflow with GoRouter in my Flutter web app without changing the URL, but I can’t manage to do it. Even with using ShellRoute. My router is as following:
final GlobalKey<NavigatorState> _shellNavigatorKey =
GlobalKey<NavigatorState>();
final GlobalKey<NavigatorState> _rootNavigatorKey = GlobalKey<NavigatorState>();
final _router = GoRouter(navigatorKey: _rootNavigatorKey, routes: [
ShellRoute(
navigatorKey: _shellNavigatorKey,
builder: (context, state, child) {
return child;
},
routes: [
GoRoute(
path: '/',
parentNavigatorKey: _shellNavigatorKey,
builder: (context, state) => const ProcessesListPage(),
routes: [
GoRoute(
path: 'process',
parentNavigatorKey: _shellNavigatorKey,
pageBuilder: (context, state) => CustomTransitionPage(
key: state.pageKey,
child: const ProcessViewerPage(),
transitionsBuilder:
(context, animation, secondaryAnimation, child) =>
SlideTransition(
position: animation.drive(
Tween<Offset>(
begin: const Offset(1, 0),
end: Offset.zero,
).chain(CurveTween(curve: Curves.easeInOut)),
),
child: child),
),
),
],
),
],
)
]);
and I navigate to the process route with context.go("/process");
But doing so, the url change from http://localhost:8000/
to http://localhost:8000/#/process
, while I would like to keep http://localhost:8000/
. I have used ShellRoute and keys but I can’t manage to make it work.
I am also open to solutions without GoRouter to achieve this.