-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[go_router] Add documentation to some methods in matching.dart #3462
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
[go_router] Add documentation to some methods in matching.dart #3462
Conversation
I would think this is a version exempt ? |
@@ -76,8 +83,11 @@ class RouteMatchList { | |||
|
|||
final List<RouteMatch> _matches; | |||
|
|||
/// the full path pattern that matches the uri. | |||
/// /family/:fid/person/:pid | |||
/// the full path pattern that matches the uri. For example: |
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.
/// the full path pattern that matches the uri. For example: | |
/// The full path pattern that matches the uri. | |
/// | |
/// For example: |
/// Returns the list of `RouteMatch` corresponding to the given [loc]. For | ||
/// example, for a given [loc] `/a/b/c/d`, this function will return the list of | ||
/// [RouteBase] `[GoRouteA(), GoRouterB(), GoRouteC(), GoRouterD()]`. |
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.
/// Returns the list of `RouteMatch` corresponding to the given [loc]. For | |
/// example, for a given [loc] `/a/b/c/d`, this function will return the list of | |
/// [RouteBase] `[GoRouteA(), GoRouterB(), GoRouteC(), GoRouterD()]`. | |
/// Returns the list of `RouteMatch` corresponding to the given [loc]. | |
/// | |
/// For example, for a given [loc] `/a/b/c/d`, this function will return the list of | |
/// [RouteBase] `[GoRouteA(), GoRouterB(), GoRouteC(), GoRouterD()]`. |
/// Generate the full path (ex: `'/family/:fid/person/:pid'`) of a list of | ||
/// [RouteMatch]. | ||
/// | ||
/// This methods considers that [matches] is ordered accorresponding to how |
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.
I can't quite parse this sentence
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.
I hope docs: Better documentation makes it clearer
/// | ||
/// - [loc] is the complete URL to match (without the query parameters). For | ||
/// example, for the URL `/a/b?c=0`, [loc] will be `/a/b`. | ||
/// - [restBloc] is the remaining part of the URL to match while [parentBloc] is |
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.
restLoc and parenetLoc?
Should the label "override: no versioning needed" be added to this PR ? Or should I create a new version? |
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.
LGTM, just some more nits
@@ -58,6 +60,34 @@ class RouteMatchList { | |||
static RouteMatchList empty = | |||
RouteMatchList(<RouteMatch>[], Uri.parse(''), const <String, String>{}); | |||
|
|||
/// Generate the full path (ex: `'/family/:fid/person/:pid'`) of a list of |
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.
/// Generate the full path (ex: `'/family/:fid/person/:pid'`) of a list of | |
/// Generates the full path (ex: `'/family/:fid/person/:pid'`) of a list of |
/// Generate the full path (ex: `'/family/:fid/person/:pid'`) of a list of | ||
/// [RouteMatch]. | ||
/// | ||
/// This methods considers that [matches]'s elements verify the go route |
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.
Maybe:
The [matches] must be the in same order of how GoRoutes are matched.
For example, if the routes structure is ...
@@ -159,6 +194,18 @@ class MatcherError extends Error { | |||
} | |||
} | |||
|
|||
/// Returns the list of `RouteMatch` corresponding to the given [loc]. |
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.
The input parameters should be in quote instead of square bracket.
/// Returns the list of `RouteMatch` corresponding to the given [loc]. | |
/// Returns the list of `RouteMatch` corresponding to the given `loc`. |
@@ -159,6 +194,18 @@ class MatcherError extends Error { | |||
} | |||
} | |||
|
|||
/// Returns the list of `RouteMatch` corresponding to the given [loc]. | |||
/// | |||
/// For example, for a given [loc] `/a/b/c/d`, this function will return the |
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.
same here and below
cc @johnpryan for secondary review |
…er#3462) [go_router] Add documentation to some methods in matching.dart
I was investigating how to fix flutter/flutter#113032 (I will soon public a design proposition as I think the entire
RouteMatchList
structure needs to be changed from a list to a tree). It is a bit hard to understand what each method was supposed to do so I added some documentation to help future contributors.Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to 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.