Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update route_data.dart
  • Loading branch information
hannah-hyj committed Jul 5, 2023
commit 0ccc64517f034ccf41af25053660e79aa5acc6a7
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 @@ -154,6 +154,8 @@ abstract class ShellRouteData extends RouteData {
required T Function(GoRouterState) factory,
GlobalKey<NavigatorState>? navigatorKey,
List<RouteBase> routes = const <RouteBase>[],
List<NavigatorObserver>? observers,
String? restorationScopeId,
}) {
T factoryImpl(GoRouterState state) {
return (_stateObjectExpando[state] ??= factory(state)) as T;
Expand Down Expand Up @@ -186,6 +188,8 @@ abstract class ShellRouteData extends RouteData {
pageBuilder: pageBuilder,
routes: routes,
navigatorKey: navigatorKey,
observers: observers,
restorationScopeId: restorationScopeId,
);
}

Expand Down Expand Up @@ -262,6 +266,7 @@ abstract class StatefulShellRouteData extends RouteData {
builder: builder,
pageBuilder: pageBuilder,
navigatorContainerBuilder: navigatorContainerBuilder,
restorationScopeId: restorationScopeId,
);
}
return StatefulShellRoute.indexedStack(
Expand Down Expand Up @@ -292,10 +297,16 @@ abstract class StatefulShellBranchData {
static StatefulShellBranch $branch<T extends StatefulShellBranchData>({
GlobalKey<NavigatorState>? navigatorKey,
List<RouteBase> routes = const <RouteBase>[],
List<NavigatorObserver>? observers,
String? initialLocation,
String? restorationScopeId,
}) {
return StatefulShellBranch(
routes: routes,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does one specify initialLocation and restorationScopeId? we may also want a way to specify observers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

navigatorKey: navigatorKey,
observers: observers,
initialLocation: initialLocation,
restorationScopeId: restorationScopeId,
);
}
}
Expand Down