[go_router] Add support for relative routes
Add supports for relative routes by allowing going to a path relatively, like go('./$path')
This PR doesn't fully resolve any issue, but it's mandatory to further add examples & tests for TypedRelativeGoRoute (see #7174), which will resolves #108177
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene page, which explains my responsibilities.
- [x] I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use
dart format.) - [x] I signed the CLA.
- [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g.
[shared_preferences] - [x] I linked to at least one issue that this PR fixes in the description above.
- [x] I updated
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes. - [x] I updated
CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes. - [x] I updated/added relevant documentation (doc comments with
///). - [x] I added new tests to check the change I am making, or this PR is test-exempt.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
@chunhtai I separated the PR as suggested. Please let me know the next steps
It was my project's need for the goRelative that I created this PR, but it's also tempted to pushRelative along with other imperative APIs. However, that'll result in a new set of APIs (goRelative, pushRelative, pushReplacementRelative , etc). Alternatively we can do make a helper function that helps user construct the relativeRoute, like context.go(context.relativeRoute('settings'). Wdyt?
Why don't you add it to the existing api.
context.go(`./settings`)
is pretty common in router modules in other frameworks as well as in bash
Why don't you add it to the existing api.
context.go(`./settings`)is pretty common in router modules in other frameworks as well as in bash
Oh yea that's cool. I didn't know of that pattern
@thangmoxielabs This branch has conflicts that must be resolved
@ThangVuNguyenViet This branch has conflicts that must be resolved @chunhtai @hannah-hyj is there any chance to fix conflicts and merge this very important feature?(How can I help?)
@ThangVuNguyenViet This branch has conflicts that must be resolved @chunhtai @hannah-hyj is there any chance to fix conflicts and merge this very important feature?(How can I help?)
You can fork and redo a pr
@cedvdb hey sorry for the late reply. I didn't see any notification
@chunhtai @hannah-hyj Could you merge this PR and release
This somehow slip through the crack. @thangmoxielabs can you fix the conflict again? sorry about the delay
@chunhtai resolved it
Hi @ThangVuNguyenViet you also need to bump the package.yaml version
Hey @chunhtai it's bumped
Hi @chunhtai
go_router was again updated 5 hours ago
Is there any chance to merge this PR before all other?
@chunhtai @ThangVuNguyenViet strange behaviour occurs when using context.push instead of context.go
Example:
/profile/referral/select-method/withdraw
When using
context.go('./select-method');
context.go('./withdraw');
it's okay.
When using
context.push('./select-method');
context.push('./withdraw');
we got "GoException: no routes for location /profile/referral/withdraw"