Closed
Description
Steps to Reproduce
- Execute
flutter run
on the code sample (see "Code sample" section below) - Click on the button "Settings" to push the settings page
- Notice the URL didn't change when using
go_router
5.2.0
Expected results:
I expect the URL to change
Actual results:
The URL didn't change
The issue doesn't happen in the previous version (5.1.10) so I believe this was introduced in flutter/packages#2786
I don't know if this is related to #99112 (comment) which plans to remove imperative methods. But since I didn't see anything in the changelogs or documentation, I'm assuming this is a regression.
Code sample
Or you can checkout https://github.com/ValentinVignal/flutter_app_stable/tree/go-router/push-no-url-change
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
void main() {
runApp(const MyApp());
}
final router = GoRouter(
routes: [
GoRoute(
path: '/',
builder: (context, state) => const Home(),
),
GoRoute(
path: '/settings',
builder: (context, state) => const Settings(),
),
],
);
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp.router(
routerConfig: router,
);
}
}
class Home extends StatelessWidget {
const Home({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Home'),
),
body: Center(
child: ElevatedButton(
onPressed: () {
router.push('/settings');
},
child: const Text('Settings'),
),
),
);
}
}
class Settings extends StatelessWidget {
const Settings({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Settings'),
),
);
}
}
Logs
Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome... 25.8s
This app is linked to the debug service: ws://127.0.0.1:51507/t8SpI7d7848=/ws
Debug service listening on ws://127.0.0.1:51507/t8SpI7d7848=/ws
💪 Running with sound null safety 💪
🔥 To hot restart changes while running, press "r" or "R".
For a more detailed help message, press "h". To quit, press "q".
An Observatory debugger and profiler on Chrome is available at: http://127.0.0.1:51507/t8SpI7d7848=
Flutter Web Bootstrap: Auto
The Flutter DevTools debugger and profiler on Chrome is available at:
http://127.0.0.1:9101?uri=http://127.0.0.1:51507/t8SpI7d7848=
Analyzing flutter_app_stable...
No issues found! (ran in 4.1s)
[✓] Flutter (Channel stable, 3.3.8, on macOS 11.6.8 20G730 darwin-x64, locale en-GB)
• Flutter version 3.3.8 on channel stable at /Users/valentin/flutter/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (2 weeks ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /usr/local/Caskroom/android-sdk/4333796
• Platform android-33, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 13C100
• CocoaPods version 1.11.3
[✓] 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-7590822)
[✓] VS Code (version 1.73.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.52.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 11.6.8 20G730 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.110
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Videos
5.2.0 | 5.1.10 |
---|---|
Screen.Recording.2022-11-24.at.10.20.44.AM.mov |
Screen.Recording.2022-11-24.at.10.17.18.AM.mov |
Metadata
Metadata
Assignees
Labels
Important issues not at the top of the work listIt was better in the past than it is nowFound to occur in 3.3Found to occur in 3.6The issue has been confirmed reproducible and is ready to work onThe go_router packageflutter/packages repository. See also p: labels.Issue is closed as already fixed in a newer version