Repository: flutter
Issue: [go_router_builder] Cannot handle query parameter when it cannot parse
Labels: package,has reproducible steps,P2,p: go_router_builder,team-go_router,triaged-go_router,found in release: 3.27,found in release: 3.28

### Steps to reproduce

1. Using `go_router_builder: ^2.7.1` and run on web
2. Navigate to route with correct query params
3. Change url with invaild query params  

### Expected results

It should can be handle in errorPageBuilder or must be try cast to avoid error 

### Actual results

Can not handle error

### Code sample

<details open><summary>Code sample</summary>

```dart
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// ignore_for_file: public_member_api_docs, unreachable_from_main

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

part 'main.g.dart';

void main() => runApp(App());

class App extends StatelessWidget {
  App({super.key});

  static const String title = 'GoRouter';

  @override
  Widget build(BuildContext context) => MaterialApp.router(
        title: title,
        routeInformationProvider: _router.routeInformationProvider,
        routeInformationParser: _router.routeInformationParser,
        backButtonDispatcher: RootBackButtonDispatcher(),
        routerDelegate: _router.routerDelegate,
        debugShowCheckedModeBanner: false,
      );

  late final GoRouter _router = GoRouter(
    debugLogDiagnostics: true,
    routes: $appRoutes,
    initialLocation: '/home',

    // redirect to the login page if the user is not logged in
    redirect: (BuildContext context, GoRouterState state) {
      // no need to redirect at all
      return null;
    },
  );
}

@TypedGoRoute<DetailRoute>(
  path: '/detail',
)
class DetailRoute extends GoRouteData {
  const DetailRoute({this.id});
  final int? id;

  @override
  Widget build(BuildContext context, GoRouterState state) =>
      const DetailScreen();
}

@TypedGoRoute<HomeRoute>(
  path: '/home',
)
class HomeRoute extends GoRouteData {
  const HomeRoute({this.fromPage});

  final String? fromPage;

  @override
  Widget build(BuildContext context, GoRouterState state) => HomeScreen();
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: MaterialButton(
          color: Colors.blue,
          onPressed: () {
            DetailRoute(id: 1).go(context);
          },
          child: Text('Go to detail'),
        ),
      ),
    );
  }
}

class DetailScreen extends StatelessWidget {
  const DetailScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Text('Detail with ${GoRouterState.of(context).uri.query}'),
      ),
    );
  }
}

```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

Uploading Ghi Màn hình 2024-12-27 lúc 10.55.03.mov…


</details>


### Logs

<details open><summary>Logs</summary>

```console
══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY ╞════════════════════════════════════════════════════════
The following FormatException was thrown while dispatching notifications for
GoRouteInformationProvider:
adaw

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:3  throw_
errors.dart:288
dart-sdk/lib/_internal/js_dev_runtime/private/profile.dart 110:39            parse
profile.dart:110
packages/error_template/main.g.dart 47:42                                    _$36convertMapValue
main.g.dart:47
packages/error_template/main.g.dart 21:13                                    $36DetailRouteExtension$124_fromState
main.g.dart:21
packages/go_router/src/route_data.dart 102:53                                factoryImpl
route_data.dart:102
packages/go_router/src/route_data.dart 112:28                                redirect
route_data.dart:112
packages/go_router/src/configuration.dart 443:56                             [_getRouteLevelRedirect]
configuration.dart:443
packages/go_router/src/configuration.dart 400:13                             processTopLevelRedirect
configuration.dart:400
packages/go_router/src/configuration.dart 417:16                             processRedirect
configuration.dart:417
packages/go_router/src/configuration.dart 423:14                             redirect
configuration.dart:423
packages/go_router/src/parser.dart 164:10                                    [_redirect]
parser.dart:164
packages/go_router/src/parser.dart 101:7                                     parseRouteInformationWithDependencies
parser.dart:101
packages/flutter/src/widgets/router.dart 753:12                              [_processRouteInformation]
router.dart:753
packages/flutter/src/widgets/router.dart 772:5                               [_handleRouteInformationProviderNotification]
router.dart:772
packages/flutter/src/foundation/change_notifier.dart 437:24                  notifyListeners
change_notifier.dart:437
packages/go_router/src/information_provider.dart 139:11                      notifyListeners
information_provider.dart:139
packages/go_router/src/information_provider.dart 245:5                       [_platformReportsNewRouteInformation]
information_provider.dart:245
packages/go_router/src/information_provider.dart 289:5                       didPushRouteInformation
information_provider.dart:289
packages/flutter/src/widgets/binding.dart 944:25                             <fn>
binding.dart:944
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 610:19          <fn>
async_patch.dart:610
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 634:23          <fn>
async_patch.dart:634
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 581:31          <fn>
async_patch.dart:581
dart-sdk/lib/async/zone.dart 1676:54                                         runUnary
zone.dart:1676
dart-sdk/lib/async/future_impl.dart 204:18                                   handleValue
future_impl.dart:204
dart-sdk/lib/async/future_impl.dart 902:44                                   handleValueCallback
future_impl.dart:902
dart-sdk/lib/async/future_impl.dart 931:13                                   _propagateToListeners
future_impl.dart:931
dart-sdk/lib/async/future_impl.dart 707:5                                    [_completeWithValue]
future_impl.dart:707
dart-sdk/lib/async/future_impl.dart 777:7                                    callback
future_impl.dart:777
dart-sdk/lib/async/schedule_microtask.dart 40:11                             _microtaskLoop
schedule_microtask.dart:40
dart-sdk/lib/async/schedule_microtask.dart 49:5                              _startMicrotaskLoop
schedule_microtask.dart:49
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 186:7           <fn>
async_patch.dart:186

The GoRouteInformationProvider sending notification was:
  Instance of 'GoRouteInformationProvider'
════════════════════════════════════════════════════════════════════════════════════════════════════
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.27.1, on macOS 14.5 23F79 darwin-arm64, locale vi-VN)
    • Flutter version 3.27.1 on channel stable at /Users/hieucg/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17025dd882 (10 days ago), 2024-12-17 03:23:09 +0900
    • Engine revision cb4b5fff73
    • Dart version 3.6.0
    • DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/hieucg/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = /Users/hieucg/Library/Android/sdk
    • 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 16.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16A242d
    • 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)

[✓] VS Code (version 1.96.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.102.0

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 131.0.6778.205

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>