packages
packages copied to clipboard
[draft] [go_router] wrap path_utils content in RoutePattern
part of https://github.com/flutter/flutter/issues/155567
This is a draft PR to see if some part of go_router can be refactored to be more readable.
Currently it is hard to know if a parameter / variable is a pattern such as /books/:bookId or a path such as /book/123 when reading the code of a given function. This PR is a stab on improving the readability on that front.
It wraps the content of path_utils in a RoutePattern class.
@chunhtai this does not compile but I'm interested in knowing whether this is a direction the team wants to go or not, I'll just close this if not.
I'll probably wait for my other PR's to go through before going any further anyway.
Pre-launch Checklist
- [ ] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [ ] I read the Tree Hygiene page, which explains my responsibilities.
- [ ] 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.) - [ ] I signed the CLA.
- [ ] The title of the PR starts with the name of the package surrounded by square brackets, e.g.
[shared_preferences] - [ ] I linked to at least one issue that this PR fixes in the description above.
- [ ] I updated
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes. - [ ] I updated
CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes. - [ ] I updated/added relevant documentation (doc comments with
///). - [ ] I added new tests to check the change I am making, or this PR is test-exempt.
- [ ] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
wrapping path_utils does make it more readable. but not sure about changing the naming convention is worthing the breaking change.
I believe it's possible to make it only internal without breaking changes, that's the requirement I'm doing this under
if we want to rename
path -> pattern location -> path
I would like us to change the public facing API such as GoRoute.path -> GoRoute.pattern etc.
but i am not sure if this worth it.
As for wrapping path_util, I think we can do it as less as breaking change as possible, and I am onboard with this.
@chunhtai So the convention used is that path is a /books/:bookId and location is /books/123 ? I had a feeling that was the case but wasn't sure. I don't think renaming is necessary.
@chunhtai So the convention used is that
pathis a/books/:bookIdandlocationis/books/123? I had a feeling that was the case but wasn't sure. I don't think renaming is necessary.
yes. that is the current naming convention.
(triage) Hi @cedvdb are you still planning on coming back to this pr?
@chunhtai This is not my priority, so I don't think I will in the near future at least. So you can close, I'll reopen if I happen to come back to this
Thanks for reply, I will close this pr for now, feel free to reopen if you have time in the future