-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Description
I'm implementing named routes in my web app to navigate to the details page with id in params.
Whenever I use context.pushReplacementNamed('campaign-details', params: {'id': campId ?? ''});
it goes to proper page in the app and updates the url as it should be
Problem:
But if I put the link directly in browser or press the refresh button of browser, I get a blank screen.
Here's how the url looks like: https://app.my-website.com/campaigns/my-campaign-id
it is also not working on local host.
Here's how the route looks like at the declaration:
GoRoute(
name: '/campaigns',
path: '/campaigns',
pageBuilder: (context, state) =>
NoTransitionPage(key: state.pageKey, child: const CampaignsScreen()),
routes: [
GoRoute(
name: 'campaign-details',
path: ':id',
pageBuilder: (context, state) {
final id = state.params['id'];
return NoTransitionPage(
key: state.pageKey, child: CampaignDetailsScreen(id));
},
),
],
),
Versions:
flutter 3.7.1 go_router: ^6.0.6
flutter doctor output
[✓] Flutter (Channel stable, 3.7.1, on macOS 13.0 22A380 darwin-arm64 (Rosetta), locale en-PK)Checking Android licenses is taking an unexpectedly long time...
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.74.3)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
• No issues found!