Skip to content

Commit

Permalink
[go_router] Fix missing build parameter in type-safe routes topic doc…
Browse files Browse the repository at this point in the history
…umentation (flutter#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.
  • Loading branch information
yamhoresh authored Oct 12, 2023
1 parent 6d4354c commit fd84e65
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/go_router/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 11.1.4

- Fixes missing parameters in the type-safe routes topic documentation.

## 11.1.3

- Fixes missing state.extra in onException().
Expand Down
4 changes: 2 additions & 2 deletions packages/go_router/doc/type-safe-routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ part 'go_router_builder.g.dart';
@immutable
class HomeScreenRoute extends GoRouteData {
@override
Widget build(BuildContext context) {
Widget build(BuildContext context, GoRouterState state) {
return const HomeScreen();
}
}
Expand All @@ -44,7 +44,7 @@ class SongRoute extends GoRouteData {
});

@override
Widget build(BuildContext context) {
Widget build(BuildContext context, GoRouterState state) {
return SongScreen(songId: id.toString());
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/go_router/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: go_router
description: A declarative router for Flutter based on Navigation 2 supporting
deep linking, data-driven routes and more
version: 11.1.3
version: 11.1.4
repository: https://github.com/flutter/packages/tree/main/packages/go_router
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22

Expand Down

0 comments on commit fd84e65

Please sign in to comment.