Skip to content

Commit c75b87c

Browse files
[go_router] Update generated output format (#9817)
The Dart 3.7+ formatter does not remove all blank lines in function calls split across multile lines, so the generated+formatted output no longer matched expetations once the example app was changed to use a minimum SDK of 3.7. This updates the example app's min SDK (thus updating the autoformatting of all of its code), and changes the code generator such that running the new formatter on the output has the same results as it did with the previous formatter. Unblocks #9816 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 5c52c55 commit c75b87c

38 files changed

+2048
-2136
lines changed

packages/go_router_builder/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.2.1
2+
3+
- Changes generated whitespace for better compatibility with new Dart formatter.
4+
15
## 3.2.0
26

37
- Adds support for`extension type`.

packages/go_router_builder/README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ The tree of routes is defined as an attribute on each of the top-level routes:
103103
@TypedGoRoute<HomeRoute>(
104104
path: '/',
105105
routes: <TypedGoRoute<GoRouteData>>[
106-
TypedGoRoute<FamilyRoute>(
107-
path: 'family/:fid',
108-
),
106+
TypedGoRoute<FamilyRoute>(path: 'family/:fid'),
109107
],
110108
)
111109
class HomeRoute extends GoRouteData with _$HomeRoute {
@@ -200,8 +198,9 @@ a return value. The generated routes also follow this functionality.
200198

201199
<?code-excerpt "example/lib/readme_excerpts.dart (awaitPush)"?>
202200
```dart
203-
final bool? result =
204-
await const FamilyRoute(fid: 'John').push<bool>(context);
201+
final bool? result = await const FamilyRoute(
202+
fid: 'John',
203+
).push<bool>(context);
205204
```
206205

207206
## Query parameters
@@ -376,10 +375,7 @@ class MyMaterialRouteWithKey extends GoRouteData with _$MyMaterialRouteWithKey {
376375
static const LocalKey _key = ValueKey<String>('my-route-with-key');
377376
@override
378377
MaterialPage<void> buildPage(BuildContext context, GoRouterState state) {
379-
return const MaterialPage<void>(
380-
key: _key,
381-
child: MyPage(),
382-
);
378+
return const MaterialPage<void>(key: _key, child: MyPage());
383379
}
384380
}
385381
```
@@ -398,12 +394,17 @@ class FancyRoute extends GoRouteData with _$FancyRoute {
398394
GoRouterState state,
399395
) {
400396
return CustomTransitionPage<void>(
401-
key: state.pageKey,
402-
child: const MyPage(),
403-
transitionsBuilder: (BuildContext context, Animation<double> animation,
404-
Animation<double> secondaryAnimation, Widget child) {
405-
return RotationTransition(turns: animation, child: child);
406-
});
397+
key: state.pageKey,
398+
child: const MyPage(),
399+
transitionsBuilder: (
400+
BuildContext context,
401+
Animation<double> animation,
402+
Animation<double> secondaryAnimation,
403+
Widget child,
404+
) {
405+
return RotationTransition(turns: animation, child: child);
406+
},
407+
);
407408
}
408409
}
409410
```
@@ -449,6 +450,7 @@ class MyGoRouteData extends GoRouteData with _$MyGoRouteData {
449450
@override
450451
Widget build(BuildContext context, GoRouterState state) => const MyPage();
451452
}
453+
452454
```
453455

454456
An example is available [here](https://github.com/flutter/packages/blob/main/packages/go_router_builder/example/lib/shell_route_with_keys_example.dart).

0 commit comments

Comments
 (0)