Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/go_router_builder/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.8.2

- Fixes issue when using query parameters that caused a nullable error

## 2.8.1

- Fixes an issue when navigate to router with invalid params
Expand Down
8 changes: 5 additions & 3 deletions packages/go_router_builder/lib/src/type_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,13 @@ String _stateValueAccess(ParameterElement element, Set<String> pathParameters) {
}

late String access;
final String suffix =
!element.type.isNullableType && !element.hasDefaultValue ? '!' : '';
if (pathParameters.contains(element.name)) {
access =
'pathParameters[${escapeDartString(element.name)}]${element.isRequired ? '!' : ''}';
access = 'pathParameters[${escapeDartString(element.name)}]$suffix';
} else {
access = 'uri.queryParameters[${escapeDartString(element.name.kebab)}]';
access =
'uri.queryParameters[${escapeDartString(element.name.kebab)}]$suffix';
}

return access;
Expand Down
2 changes: 1 addition & 1 deletion packages/go_router_builder/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: go_router_builder
description: >-
A builder that supports generated strongly-typed route helpers for
package:go_router
version: 2.8.1
version: 2.8.2
repository: https://github.com/flutter/packages/tree/main/packages/go_router_builder
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router_builder%22

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extension $NonNullableRequiredParamNotInPathExtension
on NonNullableRequiredParamNotInPath {
static NonNullableRequiredParamNotInPath _fromState(GoRouterState state) =>
NonNullableRequiredParamNotInPath(
id: int.parse(state.uri.queryParameters['id'])!,
id: int.parse(state.uri.queryParameters['id']!)!,
);

String get location => GoRouteData.$location(
Expand Down