From 188a8468f557d1f0dfdf3ab11491b8f36615577d Mon Sep 17 00:00:00 2001 From: Valentin Vignal <32538273+ValentinVignal@users.noreply.github.com> Date: Wed, 12 Jul 2023 00:04:27 +0800 Subject: [PATCH] [go_router] Fix some typos in the comments and asserts (#4412) 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].* --- packages/go_router/CHANGELOG.md | 2 ++ packages/go_router/lib/src/configuration.dart | 4 +++- packages/go_router/lib/src/information_provider.dart | 8 ++++---- packages/go_router/lib/src/match.dart | 2 +- packages/go_router/lib/src/router.dart | 6 +++--- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/go_router/CHANGELOG.md b/packages/go_router/CHANGELOG.md index bd8f397273aaa..8767c3d499a23 100644 --- a/packages/go_router/CHANGELOG.md +++ b/packages/go_router/CHANGELOG.md @@ -1,5 +1,7 @@ ## NEXT + - Fixes a typo in docs for `StatefulShellRoute.indexedStack(...)`. +- Cleans some typos in the documentation and asserts. ## 9.0.3 diff --git a/packages/go_router/lib/src/configuration.dart b/packages/go_router/lib/src/configuration.dart index a0a9b93c4e2ed..a4a9759471827 100644 --- a/packages/go_router/lib/src/configuration.dart +++ b/packages/go_router/lib/src/configuration.dart @@ -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; diff --git a/packages/go_router/lib/src/information_provider.dart b/packages/go_router/lib/src/information_provider.dart index e63ddf439f6b8..31a9e69427991 100644 --- a/packages/go_router/lib/src/information_provider.dart +++ b/packages/go_router/lib/src/information_provider.dart @@ -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 { /// Creates an InternalRouteInformationState. @@ -54,8 +54,8 @@ class RouteInformationState { /// 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? completer; diff --git a/packages/go_router/lib/src/match.dart b/packages/go_router/lib/src/match.dart index e0e98982915c3..9fef0af95b4e7 100644 --- a/packages/go_router/lib/src/match.dart +++ b/packages/go_router/lib/src/match.dart @@ -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; diff --git a/packages/go_router/lib/src/router.dart b/packages/go_router/lib/src/router.dart index 7c061df24ac28..8cd3464ba1b17 100644 --- a/packages/go_router/lib/src/router.dart +++ b/packages/go_router/lib/src/router.dart @@ -168,7 +168,7 @@ class GoRouter implements RouterConfig { '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) { @@ -258,7 +258,7 @@ class GoRouter implements RouterConfig { /// 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. @@ -320,7 +320,7 @@ class GoRouter implements RouterConfig { /// 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),