Skip to content

Commit 08b3b23

Browse files
committed
fix
1 parent 4910107 commit 08b3b23

File tree

5 files changed

+40
-31
lines changed

5 files changed

+40
-31
lines changed

packages/go_router_builder/lib/src/route_config.dart

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,9 @@ class StatefulShellBranchConfig extends RouteBaseConfig {
190190
mixin _GoRouteMixin on RouteBaseConfig {
191191
String get _basePathForLocation;
192192

193-
late final Set<String> _pathParams =
194-
pathParametersFromPattern(_basePathForLocation);
193+
late final Set<String> _pathParams = pathParametersFromPattern(
194+
_basePathForLocation,
195+
);
195196

196197
// construct path bits using parent bits
197198
// if there are any queryParam objects, add in the `queryParam` bits
@@ -377,7 +378,7 @@ mixin _GoRouteMixin on RouteBaseConfig {
377378
Iterable<String> _enumDeclarations() {
378379
final Set<InterfaceType> enumParamTypes = <InterfaceType>{};
379380

380-
for (final ParameterElement ctorParam in <ParameterElement>[
381+
for (final FormalParameterElement ctorParam in <FormalParameterElement>[
381382
..._ctorParams,
382383
..._ctorQueryParams,
383384
]) {
@@ -522,7 +523,8 @@ class RelativeGoRouteConfig extends RouteBaseConfig with _GoRouteMixin {
522523

523524
@override
524525
String get _mixinDefinition {
525-
final bool hasMixin = getNodeDeclaration<ClassDeclaration>(routeDataClass)
526+
final bool hasMixin =
527+
getNodeDeclaration<ClassDeclaration>(routeDataClass)
526528
?.withClause
527529
?.mixinTypes
528530
.any((NamedType e) => e.name2.toString() == _mixinName) ??
@@ -603,7 +605,7 @@ abstract class RouteBaseConfig {
603605

604606
factory RouteBaseConfig._fromAnnotation(
605607
ConstantReader reader,
606-
InterfaceElement element,
608+
InterfaceElement2 element,
607609
RouteBaseConfig? parent, {
608610
bool isAncestorRelative = false,
609611
}) {
@@ -749,12 +751,19 @@ abstract class RouteBaseConfig {
749751
throw UnsupportedError('Unrecognized type $typeName');
750752
}
751753

752-
value._children.addAll(reader
753-
.read(_generateChildrenGetterName(typeName))
754-
.listValue
755-
.map<RouteBaseConfig>((DartObject e) => RouteBaseConfig._fromAnnotation(
756-
ConstantReader(e), element, value,
757-
isAncestorRelative: isRelative)));
754+
value._children.addAll(
755+
reader
756+
.read(_generateChildrenGetterName(typeName))
757+
.listValue
758+
.map<RouteBaseConfig>(
759+
(DartObject e) => RouteBaseConfig._fromAnnotation(
760+
ConstantReader(e),
761+
element,
762+
value,
763+
isAncestorRelative: isRelative,
764+
),
765+
),
766+
);
758767

759768
return value;
760769
}

packages/go_router_builder/test_inputs/go_relative.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ mixin _$InnerRelativeRoute {}
1111

1212
const TypedRelativeGoRoute<RelativeRoute> relativeRoute =
1313
TypedRelativeGoRoute<RelativeRoute>(
14-
path: 'relative-route',
15-
routes: <TypedRoute<RouteData>>[
16-
TypedRelativeGoRoute<InnerRelativeRoute>(path: 'inner-relative-route')
17-
],
18-
);
14+
path: 'relative-route',
15+
routes: <TypedRoute<RouteData>>[
16+
TypedRelativeGoRoute<InnerRelativeRoute>(path: 'inner-relative-route'),
17+
],
18+
);
1919

2020
@TypedGoRoute<Route1>(
2121
path: 'route-1',

packages/go_router_builder/test_inputs/relative_route_with_absolute_path.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import 'package:go_router/go_router.dart';
66

77
mixin _$RelativeRoute {}
88

9-
@TypedRelativeGoRoute<RelativeRoute>(
10-
path: '/relative-route',
11-
)
9+
@TypedRelativeGoRoute<RelativeRoute>(path: '/relative-route')
1210
class RelativeRoute extends RelativeGoRouteData with _$RelativeRoute {
1311
const RelativeRoute();
1412
}

packages/go_router_builder/test_inputs/relative_route_with_direct_absolute_sub_route.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ class HomeRoute extends GoRouteData with _$HomeRoute {
1818

1919
const TypedRelativeGoRoute<RelativeRoute> relativeRoute =
2020
TypedRelativeGoRoute<RelativeRoute>(
21-
path: 'relative-route',
22-
routes: <TypedRoute<RouteData>>[
23-
TypedGoRoute<NonRelativeRoute>(path: 'non-relative-route'),
24-
],
25-
);
21+
path: 'relative-route',
22+
routes: <TypedRoute<RouteData>>[
23+
TypedGoRoute<NonRelativeRoute>(path: 'non-relative-route'),
24+
],
25+
);
2626

2727
class RelativeRoute extends RelativeGoRouteData with _$RelativeRoute {
2828
const RelativeRoute();

packages/go_router_builder/test_inputs/relative_route_with_indirect_absolute_sub_route.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ class HomeRoute extends GoRouteData with _$HomeRoute {
1919

2020
const TypedRelativeGoRoute<RelativeRoute> relativeRoute =
2121
TypedRelativeGoRoute<RelativeRoute>(
22-
path: 'relative-route',
23-
routes: <TypedRoute<RouteData>>[shellRoute],
24-
);
22+
path: 'relative-route',
23+
routes: <TypedRoute<RouteData>>[shellRoute],
24+
);
2525

26-
const TypedShellRoute<ShellRoute> shellRoute =
27-
TypedShellRoute<ShellRoute>(routes: <TypedRoute<RouteData>>[absoluteRoute]);
26+
const TypedShellRoute<ShellRoute> shellRoute = TypedShellRoute<ShellRoute>(
27+
routes: <TypedRoute<RouteData>>[absoluteRoute],
28+
);
2829

29-
const TypedGoRoute<AbsoluteRoute> absoluteRoute =
30-
TypedGoRoute<AbsoluteRoute>(path: 'absolute-route');
30+
const TypedGoRoute<AbsoluteRoute> absoluteRoute = TypedGoRoute<AbsoluteRoute>(
31+
path: 'absolute-route',
32+
);
3133

3234
class RelativeRoute extends RelativeGoRouteData with _$RelativeRoute {
3335
const RelativeRoute();

0 commit comments

Comments
 (0)