Skip to content

Commit fd84e65

Browse files
authored
[go_router] Fix missing build parameter in type-safe routes topic documentation (#5040)
Added the missing GoRouterState state parameter to the build methods of `HomeScreenRoute` and `SongRoute`, to the type-safe routes [topic](https://github.com/flutter/packages/blob/main/packages/go_router/doc/type-safe-routes.md). Using the current documentation (without the fix), raises the error: ``` dart 'HomeScreenRoute.build' ('Widget Function(BuildContext)') isn't a valid override of 'GoRouteData.build' ('Widget Function(BuildContext, GoRouterState)') ``` I didn't find any issue for this, but if you'd want I could simply open one myself and link it to this pull request.
1 parent 6d4354c commit fd84e65

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

packages/go_router/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 11.1.4
2+
3+
- Fixes missing parameters in the type-safe routes topic documentation.
4+
15
## 11.1.3
26

37
- Fixes missing state.extra in onException().

packages/go_router/doc/type-safe-routes.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ part 'go_router_builder.g.dart';
3030
@immutable
3131
class HomeScreenRoute extends GoRouteData {
3232
@override
33-
Widget build(BuildContext context) {
33+
Widget build(BuildContext context, GoRouterState state) {
3434
return const HomeScreen();
3535
}
3636
}
@@ -44,7 +44,7 @@ class SongRoute extends GoRouteData {
4444
});
4545

4646
@override
47-
Widget build(BuildContext context) {
47+
Widget build(BuildContext context, GoRouterState state) {
4848
return SongScreen(songId: id.toString());
4949
}
5050
}

packages/go_router/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: go_router
22
description: A declarative router for Flutter based on Navigation 2 supporting
33
deep linking, data-driven routes and more
4-
version: 11.1.3
4+
version: 11.1.4
55
repository: https://github.com/flutter/packages/tree/main/packages/go_router
66
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22
77

0 commit comments

Comments
 (0)