Repository: flutter
Issue: Web: RouteInformationParser.parseRouteInformation is not passed the state when restarting the app
Labels: framework,f: routes,platform-web,has reproducible steps,P2,found in release: 3.0,found in release: 3.1,team-web,triaged-web

## Steps to Reproduce

1. Create a new app, replace `main.dart` with the attached code.
2. Run the app.
3. Click 'Navigate Locally' to store the state in browser history.
4. Click back and forward browser buttons to verify in the console that the history entry contains the state and is received by `parseRouteInformation`.
5. Click 'Navigate Away' to leave the app and open another website.
6. Click the back browser button to reload the app.

**Expected results:** In `parseRouteInformation`, `routeInformation.state` contains `{"changed":""}` map or a serialized representation, this gets printed in the console. JavaScript's `history.state` matches the passed state.

**Actual results:** In `parseRouteInformation`, `routeInformation.state` is `null`, this gets printed in the console. JavaScript's `history.state` still has the correct state.

<details>
<summary>main.dart</summary>


```dart
import 'dart:js' as js;
import 'dart:html';

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class Configuration {
  final String? location;
  final Object? state;

  Configuration(this.location, this.state);
  @override
  toString() => '$location $state';
}

class MyRouterDelegate extends RouterDelegate<Configuration> with ChangeNotifier {
  @override
  var currentConfiguration = null;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          ElevatedButton(
            child: const Text('Navigate Locally'),
            onPressed: () {
              currentConfiguration = Configuration('/changed', {'changed': ''});
              delegate.notifyListeners();
            },
          ),
          ElevatedButton(
            child: const Text('Navigate Away'),
            onPressed: () {
              window.location.href = 'https://google.com';
            },
          ),
        ],
      ),
    );
  }

  @override
  Future<bool> popRoute() async => true;

  @override
  Future<void> setNewRoutePath(configuration) async {
    print('setNewRoutePath: $configuration');
    currentConfiguration = configuration;
    delegate.notifyListeners();
  }
}

final delegate = MyRouterDelegate();

class MyRouteInformationParser extends RouteInformationParser<Configuration> {
  @override
  Future<Configuration> parseRouteInformation(RouteInformation ri) async {
    print('');
    print('parseRouteInformation:');
    print('RouteInformation.state: ${ri.state}');
    js.context.callMethod('eval', ['console.log("JS history.state:       " + JSON.stringify(history.state.state))']);
    print('');
    return Configuration(ri.location, ri.state);
  }

  @override
  RouteInformation restoreRouteInformation(Configuration configuration) {
    return RouteInformation(
      location: configuration.location,
      state: configuration.state,
    );
  }
}

final parser = MyRouteInformationParser();

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      routerDelegate: delegate,
      routeInformationParser: parser,
      restorationScopeId: '123456',
    );
  }
}
```

</details>

<details>
  <summary>flutter doctor -v</summary>

```
[✓] Flutter (Channel stable, 3.0.5, on Ubuntu 20.04.4 LTS 5.14.0-1045-oem, locale en_US.UTF-8)
    • Flutter version 3.0.5 at /home/alexey/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (3 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/alexey/Android/Sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[✓] Android Studio (version 2021.2)
    • Android Studio at /home/alexey/bin/android-studio
    • Flutter plugin version 68.1.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.69.2)
    • VS Code at /usr/share/code
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 20.04.4 LTS 5.14.0-1045-oem
    • Chrome (web)    • chrome • web-javascript • Google Chrome 103.0.5060.134

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
```

</details>

https://user-images.githubusercontent.com/44893228/182018186-8fc67038-124d-4d96-b001-e7910319fcf2.mp4