Repository: flutter
Issue: Android Back Button Not Working On Any Tabs (Go_Router & ShellRoute)
Labels: platform-android,package,has reproducible steps,P1,p: go_router,team-go_router,:hourglass_flowing_sand:,found in release: 3.16,found in release: 3.18

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

```
root
  - /welcome
  - /splash
  - /home
    - /explore
    - /dialogs
    - /notifications
    - /settings
  - /profile
```

App starts and decides which screen to start first with below

`initialLocation: appManager.isFreshUser ? RoutePaths.welcome : RoutePaths.splash,`

In both cases it navigates to home screen (With tabs explore, dialogs, notifications, settings) with below

`router.go(RoutePaths.explore);`

### Expected results

The problem starts here,  app do not close if physical back button and gives also zero reaction.
I want to close app(not kill) with back button when on home screen


### Actual results

If we navigate to profile and then press back button, it goes back to home page. But the back button does not give reaction on home page.

### Code sample

<details><summary>Code sample</summary>

```dart
final GlobalKey<NavigatorState> shellNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'shell');
final GlobalKey<NavigatorState> parentNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'parent');

final GoRouter router = GoRouter(
  debugLogDiagnostics: true,
  navigatorKey: parentNavigatorKey,
  initialLocation: appManager.isFreshUser ? RoutePaths.welcome : RoutePaths.splash,
  routes: [
    GoRoute(
      path: RoutePaths.welcome,
      parentNavigatorKey: parentNavigatorKey,
      builder: (context, state) => const WelcomeScreen(),
    ),
    GoRoute(
      path: RoutePaths.splash,
      parentNavigatorKey: parentNavigatorKey,
      builder: (context, state) => const SplashScreen(),
    ),
    ShellRoute(
      navigatorKey: shellNavigatorKey,
      builder: (context, state, child) {
        return HomeScreen();
      },
      routes: <RouteBase>[
        GoRoute(
          path: RoutePaths.explore,
          parentNavigatorKey: shellNavigatorKey,
          pageBuilder: (context, state) => const NoTransitionPage(
            child: ExploreScreen(),
          ),
        ),
        GoRoute(
          path: RoutePaths.dialogs,
          parentNavigatorKey: shellNavigatorKey,
          pageBuilder: (context, state) => NoTransitionPage(
            key: state.pageKey,
            child: const DialogsScreen(),
          ),
        ),
        GoRoute(
          path: RoutePaths.notifications,
          parentNavigatorKey: shellNavigatorKey,
          pageBuilder: (context, state) => NoTransitionPage(
            key: state.pageKey,
            child: const NotificationsScreen(),
          ),
        ),
        GoRoute(
          path: RoutePaths.settings,
          parentNavigatorKey: shellNavigatorKey,
          pageBuilder: (context, state) => NoTransitionPage(
            key: state.pageKey,
            child: const SettingsScreen(),
          ),
        ),
      ],
    ),
    GoRoute(
      path: RoutePaths.profile,
      parentNavigatorKey: parentNavigatorKey,
      builder: (context, state) => const ProfileScreen(),
    ),
```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.16.1, on macOS 13.5.2 22G91 darwin-arm64, locale en-TR)
    • Flutter version 3.16.1 on channel stable at /Users/mee/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7f20e5d18c (4 days ago), 2023-11-27 09:47:30 -0800
    • Engine revision 22b600f240
    • Dart version 3.2.1
    • DevTools version 2.28.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/mee/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/mee/Library/Android/sdk
    • 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.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.12.1

[✓] 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)

[✓] VS Code (version 1.80.0)
    • VS Code at /Users/mee/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.78.0

[✓] Connected device (5 available)
    • MI 6 (mobile)              • 66eafcf3                             • android-arm64  • Android 9 (API 28)
    • Mee’s IPhone (mobile)  • 00008101-0006014A2278001E            • ios            • iOS 17.1.1 21B91
    • iPhone 11 Pro Max (mobile) • E6D4F26D-A7CA-4FB6-86FE-B9DBAB77F575 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)            • macos                                • darwin-arm64   • macOS 13.5.2 22G91 darwin-arm64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 119.0.6045.199

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>