-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[go_router] Add support for relative routes #6825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
02689ff
e8ac4ee
c42151c
022db98
812498e
07b63ad
c025d86
3fb6463
205d096
8e4db8e
0ead0af
9407200
6830539
43eb497
2dd80d9
3071a53
4dba574
fb61d97
d1ebfeb
c246bc3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
GoRouter.goRelative
- Adds `TypedRelativeGoRoute`
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -390,6 +390,28 @@ class TypedGoRoute<T extends GoRouteData> extends TypedRoute<T> { | |
| final List<TypedRoute<RouteData>> routes; | ||
| } | ||
|
|
||
| /// A superclass for each typed go route descendant | ||
| @Target(<TargetKind>{TargetKind.library, TargetKind.classType}) | ||
|
||
| class TypedRelativeGoRoute<T extends GoRouteData> extends TypedRoute<T> { | ||
| /// Default const constructor | ||
| const TypedRelativeGoRoute({ | ||
| required this.path, | ||
| this.routes = const <TypedRoute<RouteData>>[], | ||
| }); | ||
|
|
||
| /// The relative path that corresponds to this route. | ||
| /// | ||
| /// See [GoRoute.path]. | ||
| /// | ||
| /// | ||
| final String path; | ||
|
|
||
| /// Child route definitions. | ||
| /// | ||
| /// See [RouteBase.routes]. | ||
| final List<TypedRoute<RouteData>> routes; | ||
| } | ||
|
|
||
| /// A superclass for each typed shell route descendant | ||
| @Target(<TargetKind>{TargetKind.library, TargetKind.classType}) | ||
| class TypedShellRoute<T extends ShellRouteData> extends TypedRoute<T> { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just modify the path and use
currentUri.replace(path: newPath)This way you don't need to worry about other thing such as host/scheme/fragment/queryparameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. I move this in path_utils as
concatenateUris