Skip to content

Commit 12f0136

Browse files
Add better name and documentation
1 parent 16cadc5 commit 12f0136

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

packages/go_router/lib/src/match.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,16 +219,16 @@ abstract class RouteMatchBase with Diagnosticable {
219219
concatenatePaths(matchedLocation, pathLoc);
220220
final String newMatchedPath = concatenatePaths(matchedPath, route.path);
221221

222-
final String caseSensitiveNewMatchedLocation;
223-
final String caseSensitiveUriPath;
222+
final String newMatchedLocationToCompare;
223+
final String uriPathToCompare;
224224
if (route.caseSensitive) {
225-
caseSensitiveNewMatchedLocation = newMatchedLocation;
226-
caseSensitiveUriPath = uri.path;
225+
newMatchedLocationToCompare = newMatchedLocation;
226+
uriPathToCompare = uri.path;
227227
} else {
228-
caseSensitiveNewMatchedLocation = newMatchedLocation.toLowerCase();
229-
caseSensitiveUriPath = uri.path.toLowerCase();
228+
newMatchedLocationToCompare = newMatchedLocation.toLowerCase();
229+
uriPathToCompare = uri.path.toLowerCase();
230230
}
231-
if (caseSensitiveNewMatchedLocation == caseSensitiveUriPath) {
231+
if (newMatchedLocationToCompare == uriPathToCompare) {
232232
// A complete match.
233233
pathParameters.addAll(currentPathParameter);
234234

@@ -242,7 +242,7 @@ abstract class RouteMatchBase with Diagnosticable {
242242
],
243243
};
244244
}
245-
assert(caseSensitiveUriPath.startsWith(caseSensitiveNewMatchedLocation));
245+
assert(uriPathToCompare.startsWith(newMatchedLocationToCompare));
246246
assert(remainingLocation.isNotEmpty);
247247

248248
final String childRestLoc = uri.path.substring(

packages/go_router/lib/src/route.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,15 @@ class GoRoute extends RouteBase {
438438
/// ```
439439
final ExitCallback? onExit;
440440

441-
/// Whether the path is case sensitive or not.
441+
/// Determines whether the route matching is case sensitive.
442+
///
443+
/// When `true`, the path must match the specified case. For example,
444+
/// a [GoRoute] with `path: '/family/:fid'` will not match `/FaMiLy/f2`.
445+
///
446+
/// When `false`, the path matching is case insensitive. The route
447+
/// with `path: '/family/:fid'` will match `/FaMiLy/f2`.
448+
///
449+
/// Defaults to `true`.
442450
final bool caseSensitive;
443451

444452
// TODO(chunhtai): move all regex related help methods to path_utils.dart.

0 commit comments

Comments
 (0)