forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[go_router_builder] Support
ShellRouteData
without const
construc…
…tor (flutter#4627) Fixes flutter#131211
- Loading branch information
1 parent
228172e
commit 3c6a6bb
Showing
7 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
packages/go_router_builder/test_inputs/shell_route_data.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// 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'; | ||
|
||
@TypedShellRoute<ShellRouteNoConstConstructor>( | ||
routes: <TypedRoute<RouteData>>[], | ||
) | ||
class ShellRouteNoConstConstructor extends ShellRouteData {} | ||
|
||
@TypedShellRoute<ShellRouteWithConstConstructor>( | ||
routes: <TypedRoute<RouteData>>[], | ||
) | ||
class ShellRouteWithConstConstructor extends ShellRouteData { | ||
const ShellRouteWithConstConstructor(); | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/go_router_builder/test_inputs/shell_route_data.dart.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
RouteBase get $shellRouteNoConstConstructor => ShellRouteData.$route( | ||
factory: $ShellRouteNoConstConstructorExtension._fromState, | ||
); | ||
|
||
extension $ShellRouteNoConstConstructorExtension | ||
on ShellRouteNoConstConstructor { | ||
static ShellRouteNoConstConstructor _fromState(GoRouterState state) => | ||
ShellRouteNoConstConstructor(); | ||
} | ||
|
||
RouteBase get $shellRouteWithConstConstructor => ShellRouteData.$route( | ||
factory: $ShellRouteWithConstConstructorExtension._fromState, | ||
); | ||
|
||
extension $ShellRouteWithConstConstructorExtension | ||
on ShellRouteWithConstConstructor { | ||
static ShellRouteWithConstConstructor _fromState(GoRouterState state) => | ||
const ShellRouteWithConstConstructor(); | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/go_router_builder/test_inputs/shell_route_data_without_unnamed_constructor.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
|
||
@TypedShellRoute<ShellRouteWithoutUnnamedConstructor>( | ||
routes: <TypedRoute<RouteData>>[], | ||
) | ||
class ShellRouteWithoutUnnamedConstructor extends ShellRouteData { | ||
const ShellRouteWithoutUnnamedConstructor.namedConstructor(); | ||
} |
1 change: 1 addition & 0 deletions
1
...es/go_router_builder/test_inputs/shell_route_data_without_unnamed_constructor.dart.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The ShellRouteData "ShellRouteWithoutUnnamedConstructor" class must have an unnamed constructor. |