Repository navigation
Open
flutter/packages
#13718Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.24Found to occur in 3.24Found to occur in 3.24has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: go_routerThe go_router packageThe go_router packagep: go_router_builderThe go_router_builder packageThe go_router_builder packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Description
Steps to reproduce
Define a route with child route . all child route contains '/' in their path
ex: "/abc", "/edg"
Expected results
.g.dart file cannot generate correct path for child
Actual results
generate correct path
Code sample
Code sample
TypedGoRoute<ProfileRoute>(
path: "/profile",
routes: [
TypedGoRoute<SettingRoute>(
path: "/setting",
.... Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.5 23F79 darwin-arm64, locale vi-VN)
• Flutter version 3.24.3 on channel stable at /Users/hieucg/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2663184aa7 (4 weeks ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at /Users/hieucg/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = /Users/hieucg/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16A242d
• CocoaPods version 1.15.2
[✓] Android Studio (version 2024.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
[✓] VS Code (version 1.94.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.98.0Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.24Found to occur in 3.24Found to occur in 3.24has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: go_routerThe go_router packageThe go_router packagep: go_router_builderThe go_router_builder packageThe go_router_builder packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Activity
huycozy commentedon Oct 8, 2024
Hi @CaoGiaHieu-dev
I am using package's simple_example with modified FamilyRoute path as below but I see the generated path is expected:
Please also try the same example and confirm this. If the issue only appears on your code, please provide a minimal sample code. Thanks!
CaoGiaHieu-dev commentedon Oct 8, 2024
@huycozy thank you for your reply , it still happen on my code
Here my example
Router path
Router define
Result when using

settingResult when using

/settinghuycozy commentedon Oct 9, 2024
Thanks for your update. I see you are using StatefulShellRoute instead and it seems your routes are nested.
What is the expected result? Do you mean the
locationon setting route should be/profile/setting? (the actual and expected results in the original comment is reversed btw)Can you please leverage package's stateful_shell_route_example and share a complete updated sample code here so that others can quickly review and address this further? Thanks!
Please provide the info in text/code blocks format instead of a screenshot for better readability and investigation, see avoid posting screenshots of text.
CaoGiaHieu-dev commentedon Oct 9, 2024
@huycozy https://github.com/CaoGiaHieu-dev/go_route_issue please check this
Expect result :want use go "setting" path with or without "/"
huycozy commentedon Oct 9, 2024
Thanks for providing a complete sample code. I can reproduce the issue now. This seems to relate to 14.2.9 change:
Relaxes route path requirements. Both root and child routes can now start with or without '/'.[-][go_router_builder] : Cannot work with Go router 14.2.9 +[/-][+][go_router_builder]: Since `go_router: 14.2.9`, generated locations are different for route paths with or without splash[/+]1 remaining item
cedvdb commentedon Oct 10, 2024
go_router_builder hasn't been modified in that regard. It may needs to be upgraded as well if support for child paths starting with
/is needed in go_router_builder too. Currently the builder may not support this and the workaround is to not use that kind of path with go_router_builder.This is just a guess, without looking into it.
[-][go_router_builder]: Since `go_router: 14.2.9`, generated locations are different for route paths with or without splash[/-][+][go_router_builder]: Since `go_router: 14.2.9`, generated locations are different for route paths with or without slash[/+]test: guard a child path written with a leading slash (flutter/flutte…