-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
flutter/engine
#41384Labels
P0Critical issues such as a build break or regressionCritical issues such as a build break or regressionplatform-webWeb applications specificallyWeb applications specifically
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- Install the latest beta version of Flutter. I used
3.10.0-1.3.pre. - Create a new project and add the GoRouter package.
- Copy the provided example and paste in main.
- Run the app, navigate to the details screen, click browser navigation back arrow, and observe the error.
Expected results
The GoRouter package should work as expected without throwing the DOMException error, allowing proper navigation and routing.
Actual results
DOMException error:
DOMException: Failed to execute 'replaceState' on 'History': PopStateEvent object could not be cloned.
dart-sdk/lib/_internal/js_shared/lib/js_util_patch.dart 106:66 callMethod$
lib/_engine/engine/dom.dart 2121:19 DomHistoryExtension._replaceState
lib/_engine/engine/dom.dart 2123:7 DomHistoryExtension.replaceState
lib/_engine/engine/navigation/url_strategy.dart 241:14 replaceState
lib/_engine/engine/navigation/url_strategy.dart 74:23 replaceState
lib/_engine/engine/navigation/history.dart 188:7 onPopState
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 367:37 _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 372:39 dcall
Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
/// This sample app shows an app with two screens.
///
/// The first route '/' is mapped to [HomeScreen], and the second route
/// '/details' is mapped to [DetailsScreen].
///
/// The buttons use context.go() to navigate to each destination. On mobile
/// devices, each destination is deep-linkable and on the web, can be navigated
/// to using the address bar.
void main() => runApp(const MyApp());
/// The route configuration.
final GoRouter _router = GoRouter(
routes: <RouteBase>[
GoRoute(
path: '/',
builder: (BuildContext context, GoRouterState state) {
return const HomeScreen();
},
routes: <RouteBase>[
GoRoute(
path: 'details',
builder: (BuildContext context, GoRouterState state) {
return const DetailsScreen();
},
),
],
),
],
);
/// The main app.
class MyApp extends StatelessWidget {
/// Constructs a [MyApp]
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp.router(
routerConfig: _router,
);
}
}
/// The home screen
class HomeScreen extends StatelessWidget {
/// Constructs a [HomeScreen]
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Home Screen')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
onPressed: () => context.go('/details'),
child: const Text('Go to the Details screen'),
),
],
),
),
);
}
}
/// The details screen
class DetailsScreen extends StatelessWidget {
/// Constructs a [DetailsScreen]
const DetailsScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Details Screen')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <ElevatedButton>[
ElevatedButton(
onPressed: () => context.go('/'),
child: const Text('Go back to the Home screen'),
),
],
),
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel beta, 3.10.0-1.3.pre, on macOS 13.2.1 22D68 darwin-arm64,
locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.77.3)
[✓] Connected device (2 available)
[✓] Network resourcesasashour
Metadata
Metadata
Assignees
Labels
P0Critical issues such as a build break or regressionCritical issues such as a build break or regressionplatform-webWeb applications specificallyWeb applications specifically