diff --git a/packages/go_router/CHANGELOG.md b/packages/go_router/CHANGELOG.md index 00c63880d8c..0977df25f78 100644 --- a/packages/go_router/CHANGELOG.md +++ b/packages/go_router/CHANGELOG.md @@ -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. diff --git a/packages/go_router/lib/src/route_data.dart b/packages/go_router/lib/src/route_data.dart index 3530ca250fc..fbf396126c3 100644 --- a/packages/go_router/lib/src/route_data.dart +++ b/packages/go_router/lib/src/route_data.dart @@ -79,6 +79,7 @@ abstract class GoRouteData extends RouteData { /// Should not be used directly. static GoRoute $route({ required String path, + String? name, required T Function(GoRouterState) factory, GlobalKey? parentNavigatorKey, List routes = const [], @@ -106,6 +107,7 @@ abstract class GoRouteData extends RouteData { return GoRoute( path: path, + name: name, builder: builder, pageBuilder: pageBuilder, redirect: redirect, @@ -223,6 +225,7 @@ class TypedGoRoute extends TypedRoute { /// Default const constructor const TypedGoRoute({ required this.path, + this.name, this.routes = const >[], }); @@ -233,6 +236,14 @@ class TypedGoRoute extends TypedRoute { /// 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]. + /// + final String? name; + /// Child route definitions. /// /// See [RouteBase.routes]. diff --git a/packages/go_router/pubspec.yaml b/packages/go_router/pubspec.yaml index 1bd627951aa..3d1562db298 100644 --- a/packages/go_router/pubspec.yaml +++ b/packages/go_router/pubspec.yaml @@ -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