[go_router] Remove assert so that ShellRoute allows child ShellRoute (#2625)

diff --git a/packages/go_router/CHANGELOG.md b/packages/go_router/CHANGELOG.md
index b125525..8de1b56 100644
--- a/packages/go_router/CHANGELOG.md
+++ b/packages/go_router/CHANGELOG.md
@@ -1,4 +1,6 @@
-## NEXT
+## 5.0.1
+
+- Allows ShellRoute to have child ShellRoutes (flutter/flutter#111981)
 
 ## 5.0.0
 
diff --git a/packages/go_router/lib/src/route.dart b/packages/go_router/lib/src/route.dart
index 14800d2..9920cce 100644
--- a/packages/go_router/lib/src/route.dart
+++ b/packages/go_router/lib/src/route.dart
@@ -439,8 +439,9 @@
         navigatorKey = navigatorKey ?? GlobalKey<NavigatorState>(),
         super._() {
     for (final RouteBase route in routes) {
-      assert(route is GoRoute);
-      assert((route as GoRoute).parentNavigatorKey == null);
+      if (route is GoRoute) {
+        assert(route.parentNavigatorKey == null);
+      }
     }
   }
 
diff --git a/packages/go_router/pubspec.yaml b/packages/go_router/pubspec.yaml
index 5c67cb6..0e1074c 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: 5.0.0
+version: 5.0.1
 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
 
diff --git a/packages/go_router/test/configuration_test.dart b/packages/go_router/test/configuration_test.dart
index a01f7d1..61f769f 100644
--- a/packages/go_router/test/configuration_test.dart
+++ b/packages/go_router/test/configuration_test.dart
@@ -333,6 +333,42 @@
         );
       },
     );
+    test('does not throw when ShellRoute is the child of another ShellRoute',
+        () {
+      final GlobalKey<NavigatorState> root =
+          GlobalKey<NavigatorState>(debugLabel: 'root');
+      RouteConfiguration(
+        routes: <RouteBase>[
+          ShellRoute(
+            builder: _mockShellBuilder,
+            routes: <RouteBase>[
+              ShellRoute(
+                builder: _mockShellBuilder,
+                routes: <GoRoute>[
+                  GoRoute(
+                    path: '/a',
+                    builder: _mockScreenBuilder,
+                  ),
+                ],
+              ),
+              GoRoute(
+                path: '/b',
+                builder: _mockScreenBuilder,
+              ),
+            ],
+          ),
+          GoRoute(
+            path: '/c',
+            builder: _mockScreenBuilder,
+          ),
+        ],
+        redirectLimit: 10,
+        topRedirect: (BuildContext context, GoRouterState state) {
+          return null;
+        },
+        navigatorKey: root,
+      );
+    });
   });
 
   test(
@@ -390,35 +426,6 @@
     },
   );
 
-  test('throws when ShellRoute contains a ShellRoute', () {
-    final GlobalKey<NavigatorState> root =
-        GlobalKey<NavigatorState>(debugLabel: 'root');
-    expect(
-      () {
-        RouteConfiguration(
-          navigatorKey: root,
-          routes: <RouteBase>[
-            ShellRoute(routes: <RouteBase>[
-              ShellRoute(
-                routes: <RouteBase>[
-                  GoRoute(
-                    path: '/a',
-                    builder: _mockScreenBuilder,
-                  ),
-                ],
-              ),
-            ]),
-          ],
-          redirectLimit: 10,
-          topRedirect: (BuildContext context, GoRouterState state) {
-            return null;
-          },
-        );
-      },
-      throwsAssertionError,
-    );
-  });
-
   test('throws when ShellRoute contains a GoRoute with a parentNavigatorKey',
       () {
     final GlobalKey<NavigatorState> root =