I found what I need to modify The two sub-widgets in ShellRoute, FirestRouteData and SecondRouteData should be included in IndexRouteData. Therefore, in use, you should use build function directly instead of buildPage function, like:
class FirstRouteData extends GoRouteData {
const FirstRouteData();
// static final GlobalKey<NavigatorState> $parentNavigatorKey = shellKey;
@override
Widget build(BuildContext context, GoRouterState state) {
return const FirstScreen();
}
}
The problem of Multiple widgets used the same GlobalKey should be caused by buildPage. Let’s see if any friends online have clearer opinions.