File tree Expand file tree Collapse file tree 4 files changed +13
-3
lines changed
packages/go_router_builder Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1+ ## 2.1.1
2+
3+ * Fixes a bug that the required/positional parameters are not added to query parameters correctly.
4+
15## 2.1.0
26
37* Supports required/positional parameters that are not in the path.
Original file line number Diff line number Diff line change @@ -441,15 +441,15 @@ GoRouteData.\$route(
441441
442442 late final List <ParameterElement > _ctorParams =
443443 _ctor.parameters.where ((ParameterElement element) {
444- if (element.isRequired && ! element.isExtraField ) {
444+ if (_pathParams. contains ( element.name) ) {
445445 return true ;
446446 }
447447 return false ;
448448 }).toList ();
449449
450450 late final List <ParameterElement > _ctorQueryParams = _ctor.parameters
451451 .where ((ParameterElement element) =>
452- element.isOptional && ! element.isExtraField)
452+ ! _pathParams. contains ( element.name) && ! element.isExtraField)
453453 .toList ();
454454
455455 ConstructorElement get _ctor {
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: go_router_builder
22description : >-
33 A builder that supports generated strongly-typed route helpers for
44 package:go_router
5- version : 2.1.0
5+ version : 2.1.1
66repository : https://github.com/flutter/packages/tree/main/packages/go_router_builder
77issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router_builder%22
88
Original file line number Diff line number Diff line change @@ -68,6 +68,9 @@ extension $NullableRequiredParamNotInPathExtension
6868
6969 String get location => GoRouteData.$location(
7070 'bob',
71+ queryParams: {
72+ if (id != null) 'id': id!.toString(),
73+ },
7174 );
7275
7376 void go(BuildContext context) => context.go(location);
@@ -108,6 +111,9 @@ extension $NonNullableRequiredParamNotInPathExtension
108111
109112 String get location => GoRouteData.$location(
110113 'bob',
114+ queryParams: {
115+ 'id': id.toString(),
116+ },
111117 );
112118
113119 void go(BuildContext context) => context.go(location);
You can’t perform that action at this time.
0 commit comments