Repository: flutter
Issue: GoRouter(Builder) FormatException on illegal route parameter
Labels: c: crash,platform-web,package,has reproducible steps,P2,p: go_router,p: go_router_builder,team-go_router,triaged-go_router,found in release: 3.24,found in release: 3.26

### Steps to reproduce
- go_router: ^14.2.7
- go_router_builder: ^2.7.1

- Create a route with a typed field (e.g. int/double)
- run code generation for go_router_builder
- start web app
- navigate to the route but enter an unexpected type (e.g. String)
- FormatException is thrown and not handled (onException and errorBuilder/errorPageBuilder are not triggered)

### Expected results

onException, errorBuilder or errorPageBuilder are triggered 

### Actual results

Crash of the whole application

### Code sample

<details open><summary>Code sample</summary>

Repo: https://github.com/YukiAttano/go_router_format_exception

```dart
// Route
class SomeRoute extends GoRouteData {

  final int? id;

  const SomeRoute(this.id);

  @override
  Widget build(BuildContext context, GoRouterState state) {
    return Text(id.toString());
  }
}
```

```dart
// Entry Route for Generation
@TypedShellRoute<MainRoute>(
  routes: <TypedRoute<RouteData>>[
    TypedGoRoute<SomeRoute>(path: "/some"),
  ],
)
class MainRoute extends ShellRouteData {
  const MainRoute();

  @override
  Widget builder(BuildContext context, GoRouterState state, Widget navigator) {
    return navigator;
  }
}

```

```dart
// router
GoRouter(
  routes: $appRoutes,
  initialLocation: "/some",
  redirect: (BuildContext context, GoRouterState state) {
        if (state.fullPath == "/") return "/some";
  }
)
```
</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

<img width="512" alt="image" src="https://github.com/user-attachments/assets/8712d01b-9107-4c37-acc1-7d4efae33927">


https://github.com/user-attachments/assets/6405fbb7-4171-4ff7-b103-f69e943c7555


</details>


### Logs

_No response_

### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
 flutter doctor -v
[✓] Flutter (Channel stable, 3.24.2, on macOS 14.1 23B2073 darwin-arm64, locale de-DE)
    • Flutter version 3.24.2 on channel stable at /Users/user/Library/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cf269e36d (3 weeks ago), 2024-09-03 14:30:00 -0700
    • Engine revision a6bd3f1de1
    • Dart version 3.5.2
    • DevTools version 2.37.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/user/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.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 17.0.11+0-17.0.11b1207.24-11852314)

[✓] Connected device (4 available)
    • iPhone Small King (mobile)      • 00008110-0002643136F2201E • ios            • iOS 17.6.1 21G93
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.1 23B2073 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.1 23B2073 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 129.0.6668.58

[✓] Network resources
    • All expected network resources are available.

• No issues found!

```

</details>