Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
6 changes: 4 additions & 2 deletions packages/go_router/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
## NEXT
## 6.3.0

- Aligns Dart and Flutter SDK constraints.
- Updates compileSdkVersion to 33.
- Updates example app to iOS 11.
- Adds `navigatorKey` to `TypedShellRoute`
- Adds `parentNavigatorKey` to `TypedGoRoute`

## 6.2.0

Expand All @@ -22,7 +24,7 @@

## 6.0.8

* Adds support for Iterables, Lists and Sets in query params for TypedGoRoute. [#108437](https://github.com/flutter/flutter/issues/108437).
- Adds support for Iterables, Lists and Sets in query params for TypedGoRoute. [#108437](https://github.com/flutter/flutter/issues/108437).

## 6.0.7

Expand Down
4 changes: 4 additions & 0 deletions packages/go_router/lib/src/route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,13 @@ class GoRoute extends RouteBase {
/// re-evaluation will be triggered if the [InheritedWidget] changes.
final GoRouterRedirect? redirect;

/// {@template go_router.GoRoute.parentNavigatorKey}
/// An optional key specifying which Navigator to display this route's screen
/// onto.
///
/// Specifying the root Navigator will stack this route onto that
/// Navigator instead of the nearest ShellRoute ancestor.
/// {@endtemplate}
final GlobalKey<NavigatorState>? parentNavigatorKey;

// TODO(chunhtai): move all regex related help methods to path_utils.dart.
Expand Down Expand Up @@ -454,8 +456,10 @@ class ShellRoute extends RouteBase {
/// sub-route's observers.
final List<NavigatorObserver>? observers;

/// {@template go_router.ShellRoute.navigatorKey}
/// The [GlobalKey] to be used by the [Navigator] built for this route.
/// All ShellRoutes build a Navigator by default. Child GoRoutes
/// are placed onto this Navigator instead of the root Navigator.
/// {@endtemplate}
final GlobalKey<NavigatorState> navigatorKey;
}
8 changes: 8 additions & 0 deletions packages/go_router/lib/src/route_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ class TypedGoRoute<T extends GoRouteData> extends TypedRoute<T> {
const TypedGoRoute({
required this.path,
this.routes = const <TypedRoute<RouteData>>[],
this.parentNavigatorKey,
});

/// The path that corresponds to this route.
Expand All @@ -237,6 +238,9 @@ class TypedGoRoute<T extends GoRouteData> extends TypedRoute<T> {
///
/// See [RouteBase.routes].
final List<TypedRoute<RouteData>> routes;

/// {@macro go_router.GoRoute.parentNavigatorKey}
final GlobalKey<NavigatorState>? parentNavigatorKey;
}

/// A superclass for each typed shell route descendant
Expand All @@ -245,12 +249,16 @@ class TypedShellRoute<T extends ShellRouteData> extends TypedRoute<T> {
/// Default const constructor
const TypedShellRoute({
this.routes = const <TypedRoute<RouteData>>[],
this.navigatorKey,
});

/// Child route definitions.
///
/// See [RouteBase.routes].
final List<TypedRoute<RouteData>> routes;

/// {@macro go_router.ShellRoute.navigatorKey}
final GlobalKey<NavigatorState>? navigatorKey;
}

/// Internal class used to signal that the default page behavior should be used.
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.2.0
version: 6.3.0
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