Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[go_router] Adds name to TypedGoRoute #3702

Merged
merged 7 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
## 6.5.8

- Adds name parameter to `TypedGoRoute`

## 6.5.7

- Fixes a bug that go_router would crash if `GoRoute.pageBuilder` depends on `InheritedWidget`s.
Expand Down
11 changes: 11 additions & 0 deletions packages/go_router/lib/src/route_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ abstract class GoRouteData extends RouteData {
/// Should not be used directly.
static GoRoute $route<T extends GoRouteData>({
required String path,
String? name,
required T Function(GoRouterState) factory,
GlobalKey<NavigatorState>? parentNavigatorKey,
List<RouteBase> routes = const <RouteBase>[],
Expand Down Expand Up @@ -106,6 +107,7 @@ abstract class GoRouteData extends RouteData {

return GoRoute(
path: path,
name: name,
builder: builder,
pageBuilder: pageBuilder,
redirect: redirect,
Expand Down Expand Up @@ -223,6 +225,7 @@ class TypedGoRoute<T extends GoRouteData> extends TypedRoute<T> {
/// Default const constructor
const TypedGoRoute({
required this.path,
this.name,
this.routes = const <TypedRoute<RouteData>>[],
});

Expand All @@ -233,6 +236,14 @@ class TypedGoRoute<T extends GoRouteData> extends TypedRoute<T> {
///
final String path;

/// The name that corresponds to this route.
/// Used by Analytics services such as Firebase Analytics
/// to log the screen views in their system.
///
/// See [GoRoute.name].
dancamdev marked this conversation as resolved.
Show resolved Hide resolved
///
final String? name;

/// Child route definitions.
///
/// See [RouteBase.routes].
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: 6.5.7
version: 6.5.8
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