Skip to content

Commit c27baed

Browse files
ValentinVignalOrtes
authored andcommitted
[go_router] Add missing caseSensitive parameter to GoRouteData.$route (flutter#9126)
Part of flutter/flutter#167277 I missed this parameter in flutter#9096. This PR adds it. After that, I'll be able to make a PR for go_router_builder ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent fbf3951 commit c27baed

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

packages/go_router/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 15.1.1
2+
3+
- Adds missing `caseSensitive` to `GoRouteData.$route`.
4+
15
## 15.1.0
26

37
- Adds `caseSensitive` to `TypedGoRoute`.

packages/go_router/lib/src/route_data.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ abstract class GoRouteData extends RouteData {
8686
static GoRoute $route<T extends GoRouteData>({
8787
required String path,
8888
String? name,
89+
bool caseSensitive = true,
8990
required T Function(GoRouterState) factory,
9091
GlobalKey<NavigatorState>? parentNavigatorKey,
9192
List<RouteBase> routes = const <RouteBase>[],
@@ -117,6 +118,7 @@ abstract class GoRouteData extends RouteData {
117118
return GoRoute(
118119
path: path,
119120
name: name,
121+
caseSensitive: caseSensitive,
120122
builder: builder,
121123
pageBuilder: pageBuilder,
122124
redirect: redirect,

packages/go_router/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: go_router
22
description: A declarative router for Flutter based on Navigation 2 supporting
33
deep linking, data-driven routes and more
4-
version: 15.1.0
4+
version: 15.1.1
55
repository: https://github.com/flutter/packages/tree/main/packages/go_router
66
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22
77

packages/go_router/test/route_data_test.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,31 @@ void main() {
255255
expect(find.byKey(const Key('buildPage')), findsOneWidget);
256256
},
257257
);
258+
259+
testWidgets(
260+
'It should build a go route with the default case sensitivity',
261+
(WidgetTester tester) async {
262+
final GoRoute routeWithDefaultCaseSensitivity = GoRouteData.$route(
263+
path: '/path',
264+
factory: (GoRouterState state) => const _GoRouteDataBuild(),
265+
);
266+
267+
expect(routeWithDefaultCaseSensitivity.caseSensitive, true);
268+
},
269+
);
270+
271+
testWidgets(
272+
'It should build a go route with the overridden case sensitivity',
273+
(WidgetTester tester) async {
274+
final GoRoute routeWithDefaultCaseSensitivity = GoRouteData.$route(
275+
path: '/path',
276+
caseSensitive: false,
277+
factory: (GoRouterState state) => const _GoRouteDataBuild(),
278+
);
279+
280+
expect(routeWithDefaultCaseSensitivity.caseSensitive, false);
281+
},
282+
);
258283
});
259284

260285
group('ShellRouteData', () {

0 commit comments

Comments
 (0)