Skip to content
Merged
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.3.4

* Fixes a bug of typeArguments losing NullabilitySuffix

## 2.3.3

* Adds `initialLocation` for `StatefulShellBranchConfig`
Expand Down
2 changes: 1 addition & 1 deletion packages/go_router_builder/lib/src/type_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ String enumMapName(InterfaceType type) => '_\$${type.element.name}EnumMap';

String _stateValueAccess(ParameterElement element, Set<String> pathParameters) {
if (element.isExtraField) {
return 'extra as ${element.type.getDisplayString(withNullability: element.isOptional)}';
return 'extra as ${element.type.getDisplayString(withNullability: true)}';
}

late String 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.3.3
version: 2.3.4
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
@@ -0,0 +1,12 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:go_router/go_router.dart';

@TypedGoRoute<RequiredNullableTypeArgumentsExtraValueRoute>(
path: '/default-value-route')
class RequiredNullableTypeArgumentsExtraValueRoute extends GoRouteData {
RequiredNullableTypeArgumentsExtraValueRoute({required this.$extra});
final List<int?> $extra;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
RouteBase get $requiredNullableTypeArgumentsExtraValueRoute =>
GoRouteData.$route(
path: '/default-value-route',
factory:
$RequiredNullableTypeArgumentsExtraValueRouteExtension._fromState,
);

extension $RequiredNullableTypeArgumentsExtraValueRouteExtension
on RequiredNullableTypeArgumentsExtraValueRoute {
static RequiredNullableTypeArgumentsExtraValueRoute _fromState(
GoRouterState state) =>
RequiredNullableTypeArgumentsExtraValueRoute(
$extra: state.extra as List<int?>,
);

String get location => GoRouteData.$location(
'/default-value-route',
);

void go(BuildContext context) => context.go(location, extra: $extra);

Future<T?> push<T>(BuildContext context) =>
context.push<T>(location, extra: $extra);

void pushReplacement(BuildContext context) =>
context.pushReplacement(location, extra: $extra);

void replace(BuildContext context) =>
context.replace(location, extra: $extra);
}