Repository: flutter
Issue: When popping a route inside shellroute to one outside it doesn't return value
Labels: package,has reproducible steps,P1,p: go_router,team-go_router,triaged-go_router,found in release: 3.19,found in release: 3.22

### Steps to reproduce

1. Push a route that's inside a `ShellRoute` from a route outside it. Use `var value = await context.push('/routeName')`
2. Inside the pushed route, execute `context.pop('sample value')`
3. Observe the `value` returned by the pushed shellroute. This part of the code is never reached. 

For context, I'm using a ShellRoute to add wrapper code around a set of routes. There is no UI being rendered by the ShellRoute. More specifically, I'm specifying a `BlocProvider` on the shellroute's builder. The bloc stays open as long as the app is within one of the child routes and closes when the shellroute is popped. 

### Expected results

I expected the resulting code from `context.push` to return a value from the shell route.

### Actual results

No value is returned. When using `await context.push`, no line after this is executed. 

### Code sample

Copy and paste this code into a fresh flutter project's `main.dart`. Install go_router 13.2.2.

Routes are defined as follows:
```
- /
- /non-shell-settings
- ShellRoute
  - /settings
  - /details
```
Going from root level to root level or shell route to shell route doesn't have any issues. The issue between root and shellroute not returning the popped value. 

```dart
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

void main() {
  runApp(const MyApp());
}

final GlobalKey<NavigatorState> _rootNavigatorKey = GlobalKey<NavigatorState>();
final GlobalKey<NavigatorState> _shellNavigatorKey =
    GlobalKey<NavigatorState>();

final GoRouter _router = GoRouter(
  debugLogDiagnostics: true,
  navigatorKey: _rootNavigatorKey,
  initialLocation: '/',
  routes: <RouteBase>[
    GoRoute(
      path: '/',
      parentNavigatorKey: _rootNavigatorKey,
      builder: (BuildContext context, GoRouterState state) {
        return const MyHomePage(title: 'Flutter Home');
      },
    ),
    GoRoute(
      path: '/non-shell-settings',
      parentNavigatorKey: _rootNavigatorKey,
      builder: (BuildContext context, GoRouterState state) {
        return const SettingsScreen();
      },
    ),
    ShellRoute(
        navigatorKey: _shellNavigatorKey,
        parentNavigatorKey: _rootNavigatorKey,
        builder: (context, state, child) {
          return Scaffold(
              appBar: AppBar(title: const Text('Shell route')), body: child);
        },
        routes: [
          GoRoute(
            path: '/details',
            builder: (BuildContext context, GoRouterState state) {
              return const DetailsScreen();
            },
          ),
          GoRoute(
            path: '/settings',
            builder: (BuildContext context, GoRouterState state) {
              return const SettingsScreen();
            },
          )
        ])
  ],
);

class DetailsScreen extends StatelessWidget {
  const DetailsScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
            child: Column(
      children: [
        const Text('Details'),
        ElevatedButton(
            onPressed: () {
              context.pop('popped value from details page');
            },
            child: const Text('Go Back'))
      ],
    )));
  }
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      routerConfig: _router,
    );
  }
}

class SettingsScreen extends StatelessWidget {
  const SettingsScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
            child: Column(
      children: [
        ElevatedButton(
            onPressed: () async {
              var value = await context.push('/details');
              if (kDebugMode) {
                print('Returned from details screen with this message: $value');
              }
            },
            child: const Text('Go to details')),
        const Text('Settings'),
        ElevatedButton(
            onPressed: () {
              context.pop('popped value from settings page');
            },
            child: const Text('Go Back'))
      ],
    )));
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ElevatedButton(
                onPressed: () async {
                  var value = await context.push('/settings');
                  if (kDebugMode) {
                    print(
                        'Returned from settings screen with this message: $value');
                  }
                },
                child: const Text('Go To Settings Screen')),
            ElevatedButton(
                onPressed: () async {
                  var value = await context.push('/non-shell-settings');
                  if (kDebugMode) {
                    print('Returned from settings screen with this message: $value');
                  }
                },
                child: const Text('Go to settings outside shell route')),
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
```

### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

```
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Running Gradle task 'assembleDebug'...
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app-debug.apk...
Debug service listening on ws://127.0.0.1:52174/p7TM5Em1Gqk=/ws
Syncing files to device sdk gphone64 arm64...
[GoRouter] Full paths for routes:
  => /
  => /non-shell-settings
  => /details
  => /settings

[GoRouter] setting initial location /
[GoRouter] Using MaterialApp configuration
[GoRouter] pushing /non-shell-settings
W/WindowOnBackDispatcher(28824): OnBackInvokedCallback is not enabled for the application.
W/WindowOnBackDispatcher(28824): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
D/EGL_emulation(28824): app_time_stats: avg=243.00ms min=1.28ms max=3028.86ms count=25
[GoRouter] popping /
I/flutter (28824): Returned from settings screen with this message: popped value from settings page
D/EGL_emulation(28824): app_time_stats: avg=338.49ms min=0.98ms max=10099.44ms count=30
[GoRouter] pushing /non-shell-settings
W/WindowOnBackDispatcher(28824): OnBackInvokedCallback is not enabled for the application.
W/WindowOnBackDispatcher(28824): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
D/EGL_emulation(28824): app_time_stats: avg=37.45ms min=0.94ms max=1166.14ms count=33
I/flutter (28824): Returned from settings screen with this message: popped value from settings page
[GoRouter] popping /
D/EGL_emulation(28824): app_time_stats: avg=124.72ms min=13.93ms max=3149.51ms count=29
[GoRouter] pushing /settings
[GoRouter] Using MaterialApp configuration
W/WindowOnBackDispatcher(28824): OnBackInvokedCallback is not enabled for the application.
W/WindowOnBackDispatcher(28824): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
D/EGL_emulation(28824): app_time_stats: avg=52.35ms min=1.30ms max=968.30ms count=25
[GoRouter] popping /
D/EGL_emulation(28824): app_time_stats: avg=247.04ms min=14.61ms max=6470.24ms count=28
```

### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
➜  gorouter_bloc_fun flutter doctor -v
[✓] Flutter (Channel stable, 3.16.5, on macOS 14.4.1 23E224 darwin-arm64, locale en-CA)
    • Flutter version 3.16.5 on channel stable at /Users/raj/code/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 78666c8dc5 (4 months ago), 2023-12-19 16:14:14 -0800
    • Engine revision 3f3e560236
    • Dart version 3.2.3
    • DevTools version 2.28.4

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/raj/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.14.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.5)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 77.1.3
    • Dart plugin version 232.10248

[✓] Connected device (4 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554             • android-arm64  • Android 14 (API 34) (emulator)
    • Raj Phull’s iPhone (mobile) • 00008120-00126DC80E53C01E • ios            • iOS 17.3.1 21D61
    • macOS (desktop)             • macos                     • darwin-arm64   • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)                • chrome                    • web-javascript • Google Chrome 123.0.6312.107
    ! Error: Browsing on the local area network for Rajjeet’s iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for Raj's Test iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.
```

</details>