[go_router] Adds void replace() and replaceNamed to GoRouterDelegate, GoRouter and GoRouterHelper#2306
Conversation
|
@chunhtai please look into this |
chunhtai
left a comment
There was a problem hiding this comment.
code looks good, left some documentation nits
| extra: extra, | ||
| ); | ||
|
|
||
| /// Replaces the current location with the given one w/ optional query |
There was a problem hiding this comment.
| /// Replaces the current location with the given one w/ optional query | |
| /// Replaces the top-most page of page stack with the given URL location w/ optional query |
| ); | ||
|
|
||
| /// Replaces the current location with the given one w/ optional query | ||
| /// parameters, e.g. `/family/f2/person/p1?color=blue |
There was a problem hiding this comment.
maybe also mention go/push use
See also:
* [go], which ....
* [push], which ...
| void replace(String location, {Object? extra}) => | ||
| GoRouter.of(this).replace(location, extra: extra); | ||
|
|
||
| /// Replaces the current location with the named route w/ optional parameters, |
There was a problem hiding this comment.
| /// Replaces the current location with the named route w/ optional parameters, | |
| /// Replaces the top-most page of page stack with the named route w/ optional parameters, |
| GoRouter.of(this).replace(location, extra: extra); | ||
|
|
||
| /// Replaces the current location with the named route w/ optional parameters, | ||
| /// e.g. `name='person', params={'fid': 'f2', 'pid': 'p1'}` |
There was a problem hiding this comment.
also use the See also to mention goNamed and pushNamed
|
there is a merge conflict, can you resolve them before this pr can merge? |
# Conflicts: # packages/go_router/CHANGELOG.md # packages/go_router/pubspec.yaml
I fixed the conflicts in a9019f9 |
| @@ -1,3 +1,6 @@ | |||
| ## 4.2.0 | |||
|
|
|||
| - Adds `void replace()` and `replaceNamed` to `GoRouterDelegate`, `GoRouter` and `GoRouterHelper`. | |||
There was a problem hiding this comment.
nit: add an empty line between two versions
There was a problem hiding this comment.
Oops sorry for that, I added that in 8ec9776
|
cc @johnpryan for a secondary review |
| ); | ||
| }); | ||
|
|
||
| group('replace', () { |
There was a problem hiding this comment.
consider adding a test for replaceNamed too?
There was a problem hiding this comment.
I added a test for replaceNamed in 44e35ef Tell me what you think about it
* Refactor internal classes and methods - Separate matching from redirection - Add RouteRedirector typedef - Add RouteMatcher class - Add RouteBuilder class - Add RouteConfiguration class - Rename and reorganize internal classes and libraries - Add todo comments * format * Sort imports * Update changelog * Address code review comments - Change name back to GoRouterRefreshStream - Update toString() methods for new naming - Make fields final - Add logging to parser - Add comments - add tests - Move function-scope to new library-scope _addRedirect function - import widgets instead of material where possible * remove routing library * Move classes in go_router.dart into separate libraries * Move Configuration.validate() into constructor * Remove comment * use continue in redirect loop * Fix comments * Sort imports * Fix logging in configuration * add visibleForTesting annotation * Updates from merge with main * Format * Add TODOs to make Router implementation classes private * Add copyright headers * Fix tests * format * fix comment * Update packages/go_router/lib/src/parser.dart Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com> * add whitespace * format * Hide typedefs that weren't previously exported * Delete empty file * add missing import * Specify version 4.1.2 in pubspec.yaml * Update packages/go_router/lib/src/builder.dart Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com> * Fix comment * Add isError and error getters to RouteMatchList * Add issue links to TODO comments * Add link to issue for TODO * Re-apply code from #2306 due to merge conflicts * Add issue references Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com> Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
This PR Adds
void replace()andreplaceNamedtoGoRouterDelegate,GoRouterandGoRouterHelper.It should fix flutter/flutter#106402
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.