Skip to content

Commit

Permalink
[go_router] Fix some typos in the comments and asserts (flutter#4412)
Browse files Browse the repository at this point in the history
While I'm working on making the `RouteMatchList` a `RouteMatchTree`, I'm fixing some typos/inconsistency in the comments and the assert messages. This PR fixes some of them.

*List which issues are fixed by this PR. You must list at least one issue.*

No issue but linked to https://docs.google.com/document/d/1HCgLi7ialw2Eqv-f_2z9ogdOfcmepIIqCsRhF-DT9dM/

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
  • Loading branch information
ValentinVignal authored Jul 11, 2023
1 parent e47a2b5 commit 188a846
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions packages/go_router/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## NEXT

- Fixes a typo in docs for `StatefulShellRoute.indexedStack(...)`.
- Cleans some typos in the documentation and asserts.

## 9.0.3

Expand Down
4 changes: 3 additions & 1 deletion packages/go_router/lib/src/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class RouteConfiguration {
}
} else {
if (route.path.startsWith('/') || route.path.endsWith('/')) {
throw GoError('sub-route path may not start or end with /: $route');
throw GoError(
'sub-route path may not start or end with "/": $route',
);
}
}
subRouteIsTopLevel = false;
Expand Down
8 changes: 4 additions & 4 deletions packages/go_router/lib/src/information_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ enum NavigatingType {
}

/// The data class to be stored in [RouteInformation.state] to be used by
/// [GoRouteInformationPrarser].
/// [GoRouteInformationParser].
///
/// This state class is used internally in go_router and will not be send to
/// This state class is used internally in go_router and will not be sent to
/// the engine.
class RouteInformationState<T> {
/// Creates an InternalRouteInformationState.
Expand All @@ -54,8 +54,8 @@ class RouteInformationState<T> {
/// The extra object used when navigating with [GoRouter].
final Object? extra;

/// The completer that needs to be complete when the newly added route is
/// popped off the screen..
/// The completer that needs to be completed when the newly added route is
/// popped off the screen.
///
/// This is only null if [type] is [NavigatingType.go].
final Completer<T?>? completer;
Expand Down
2 changes: 1 addition & 1 deletion packages/go_router/lib/src/match.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class RouteMatch {
/// for example:
///
/// uri = '/family/f2/person/p2'
/// route = GoRoute('/family/:id)
/// route = GoRoute('/family/:id')
///
/// matchedLocation = '/family/f2'
final String matchedLocation;
Expand Down
6 changes: 3 additions & 3 deletions packages/go_router/lib/src/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class GoRouter implements RouterConfig<RouteMatchList> {
'top-level path must start with "/": $route');
} else {
assert(!route.path.startsWith('/') && !route.path.endsWith('/'),
'sub-route path may not start or end with /: $route');
'sub-route path may not start or end with "/": $route');
}
subRouteIsTopLevel = false;
} else if (route is ShellRouteBase) {
Expand Down Expand Up @@ -258,7 +258,7 @@ class GoRouter implements RouterConfig<RouteMatchList> {

/// Whether the imperative API affects browser URL bar.
///
/// The Imperative APIs refer to [push], [pushReplacement], or [Replace].
/// The Imperative APIs refer to [push], [pushReplacement], or [replace].
///
/// If this option is set to true. The URL bar reflects the top-most [GoRoute]
/// regardless the [RouteBase]s underneath.
Expand Down Expand Up @@ -320,7 +320,7 @@ class GoRouter implements RouterConfig<RouteMatchList> {

/// Restore the RouteMatchList
void restore(RouteMatchList matchList) {
log.info('going to ${matchList.uri}');
log.info('restoring ${matchList.uri}');
routeInformationProvider.restore(
matchList.uri.toString(),
encodedMatchList: RouteMatchListCodec(configuration).encode(matchList),
Expand Down

0 comments on commit 188a846

Please sign in to comment.