Repository: flutter
Issue: [production][go_router]: GoRouterDelegate.location throws Bad state: No element.
Labels: c: crash,package,a: production,P2,needs repro info,p: go_router,team-go_router,triaged-go_router

This is a very rare error we've seen on production Crashlytics. We're not sure of the trigger and have no reproduction.

Device was Galaxy Z Fold3 5G. Seen on go_router 3.0.4.

```
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Bad state: No element. Error thrown Instance of 'ErrorDescription'.
       at _GrowableList.last(_GrowableList.java)
       at GoRouterDelegate.location(go_router_delegate.dart:200)
       at GoRouterDelegate._builder(go_router_delegate.dart:684)
       at GoRouterDelegate.build(go_router_delegate.dart:223)
       at _MaterialStatePropertyWith.resolve(material_state.dart:663)
       at StatelessElement.build(framework.dart:4827)
       at ComponentElement.performRebuild(framework.dart:4754)
       at Element.rebuild(framework.dart:4477)
       at StatelessElement.update(framework.dart:4834)
       at Element.updateChild(framework.dart:3501)
       at ComponentElement.performRebuild(framework.dart:4780)
       at Element.rebuild(framework.dart:4477)
       at ProxyElement.update(framework.dart:5108)
       at Element.updateChild(framework.dart:3501)
       at ComponentElement.performRebuild(framework.dart:4780)
       at Element.rebuild(framework.dart:4477)
       at ProxyElement.update(framework.dart:5108)
       at Element.updateChild(framework.dart:3501)
       at ComponentElement.performRebuild(framework.dart:4780)
       at StatefulElement.performRebuild(framework.dart:4928)
       at Element.rebuild(framework.dart:4477)
       at BuildOwner.buildScope(framework.dart:2659)
       at WidgetsBinding.drawFrame(binding.dart:882)
       at RendererBinding._handlePersistentFrameCallback(binding.dart:363)
       at SchedulerBinding._invokeFrameCallback(binding.dart:1144)
       at SchedulerBinding.handleDrawFrame(binding.dart:1081)
       at SchedulerBinding._handleDrawFrame(binding.dart:995)
```

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->

```
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, 2.10.1, on macOS 12.3 21E230 darwin-arm, locale en-US)
    • Flutter version 2.10.1 at /Users/james/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db747aa133 (7 weeks ago), 2022-02-09 13:57:35 -0600
    • Engine revision ab46186b24
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/james/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • 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 11.0.11+0-b60-7772763)

[✓] VS Code (version 1.65.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.32.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 99.0.4844.84

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```

</details>


<!--
      Consider also attaching screenshots and/or videos to better
      illustrate the issue.

      You can upload them directly on GitHub.
      Beware that video file size is limited to 10MB.
-->