Repository navigation
Closed
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectfound in release: 3.32Found to occur in 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33Found to occur in 3.33has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: go_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-webWeb applications specificallyWeb applications specificallyteam-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Description
Steps to reproduce
Put special characters, encoded or not, in url, then hit Refresh. They are automatically converted back to its non-encoded form.
Expected results
Special characters are not encoded in urls
Actual results
Special characters are encoded in urls
Code sample
main.dart
import 'package:flutter/material.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'package:go_router/go_router.dart';
import 'package:testing_textfield/router.dart';
void main() {
GoRouter.optionURLReflectsImperativeAPIs = true;
setUrlStrategy(PathUrlStrategy());
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
late final _router = GoRouter(
initialLocation: '/',
routes: $appRoutes,
debugLogDiagnostics: true,
);
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: 'TESTING GO ROUTER',
theme: ThemeData(
primarySwatch: Colors.blue,
scaffoldBackgroundColor: const Color.fromARGB(255, 235, 235, 241),
),
routeInformationParser: _router.routeInformationParser,
routeInformationProvider: _router.routeInformationProvider,
routerDelegate: _router.routerDelegate,
);
}
}
router.dart
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:testing_textfield/test_text_field.dart';
part 'router.g.dart';
@TypedGoRoute<HomeRouter>(path: '/')
class HomeRouter extends GoRouteData {
const HomeRouter({this.text});
final String? text;
@override
Page<void> buildPage(BuildContext context, GoRouterState state) {
return NoTransitionPage(
child: Scaffold(
backgroundColor: Colors.white,
key: UniqueKey(),
body: TestTextFieldScreen(text: text),
));
}
}
router.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'router.dart';
// **************************************************************************
// GoRouterGenerator
// **************************************************************************
List<RouteBase> get $appRoutes => [
$homeRouter,
];
RouteBase get $homeRouter => GoRouteData.$route(
path: '/',
factory: $HomeRouterExtension._fromState,
);
extension $HomeRouterExtension on HomeRouter {
static HomeRouter _fromState(GoRouterState state) => HomeRouter(
text: state.uri.queryParameters['text'],
);
String get location => GoRouteData.$location(
'/',
queryParams: {
if (text != null) 'text': text,
},
);
void go(BuildContext context) => context.go(location);
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
void replace(BuildContext context) => context.replace(location);
}
test_text_field.dart
import 'package:flutter/material.dart';
import 'package:testing_textfield/router.dart';
class TestTextFieldScreen extends StatefulWidget {
const TestTextFieldScreen({super.key, this.text});
final String? text;
@override
State<TestTextFieldScreen> createState() => _TestTextFieldScreenState();
}
class _TestTextFieldScreenState extends State<TestTextFieldScreen> {
final ctrl = TextEditingController();
@override
void dispose() {
ctrl.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Center(
child: Column(
children: [
TextFormField(
controller: ctrl,
),
const SizedBox(height: 20),
Text('Non decoded text: ' + (widget.text ?? '')),
const SizedBox(height: 20),
Text('Decoded text: ' + Uri.decodeQueryComponent(widget.text ?? '')),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
OutlinedButton(
onPressed: () {
HomeRouter(text: ctrl.text).go(context);
},
child: const Text('Send non encoded text')),
const SizedBox(width: 20),
OutlinedButton(
onPressed: () {
HomeRouter(text: Uri.encodeQueryComponent(ctrl.text))
.go(context);
},
child: const Text('Send encoded text')),
],
)
],
),
);
}
}
Screenshots or Video
Screen.Recording.2025-07-08.at.15.58.19.mov
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
This app is linked to the debug service: ws://127.0.0.1:53889/-RI1VrrJ2k8=/ws
Debug service listening on ws://127.0.0.1:53889/-RI1VrrJ2k8=/ws
Debug service listening on ws://127.0.0.1:53889/-RI1VrrJ2k8=/ws
[GoRouter] Full paths for routes:
└─/ (Widget)
[GoRouter] setting initial location /
[GoRouter] going to /?text=a%2Bb
[GoRouter] Full paths for routes:
└─/ (Widget)
[GoRouter] setting initial location /
[GoRouter] going to /?text=a%252Bb
[GoRouter] Full paths for routes:
└─/ (Widget)
[GoRouter] setting initial location /Flutter Doctor output
Doctor output
[!] Flutter (Channel [user-branch], 3.24.3, on macOS 15.2 24C101 darwin-arm64, locale en-VN)
! Flutter version 3.24.3 on channel [user-branch] at /Users/mht/flutter
Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
! Upstream repository unknown source is not a standard remote.
Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
• Framework revision 2663184aa7 (10 months ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/mht/Library/Android/sdk
• Platform android-34, build-tools 33.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 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
! Flutter recommends a minimum Xcode version of 15.
Download the latest version or update via the Mac App Store.
! CocoaPods 1.11.3 out of date (1.13.0 is recommended).
CocoaPods is a package manager for iOS or macOS platform code.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/to/platform-plugins
To update CocoaPods, see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods
[✓] 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)
[✓] Android Studio (version 2021.2)
• Android Studio at /Volumes/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.12+0-b1504.28-7817840)
[✓] VS Code (version 1.96.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] VS Code (version 1.98.2)
• VS Code at /Volumes/Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 15.2 24C101 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.2 24C101 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 138.0.7204.93
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories.
Reacted by sachabydonSO
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectfound in release: 3.32Found to occur in 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33Found to occur in 3.33has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: go_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-webWeb applications specificallyWeb applications specificallyteam-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Activity
darshankawar commentedon Jul 8, 2025
@glaceon2000
Please check #140139 and #101757 (comment) to see if they help further in your case or not.
I also suggest you to upgrade to latest stable and re-run to check if you still get same behavior or not.
glaceon2000 commentedon Jul 9, 2025
I have tested on flutter version 3.29.0 and go_router 16.0.0, which produced the same problem. My issue is not similar to the issues you've linked. In fact it's quite the opposite, as in I put encoded values and they're converted on the url to their non-encoded form.
darshankawar commentedon Jul 10, 2025
Please try with latest stable (3.32.5)
glaceon2000 commentedon Jul 11, 2025
I've tried with 3.32.5. The same behavior persists
darshankawar commentedon Jul 11, 2025
Thanks for the update. Seeing the same behavior as reported.
2 remaining items
ArthurHlt commentedon Sep 26, 2025
@glaceon2000 I've found an issue and send a PR, but if you need a workaround this is what we have done in our code:
For usage after:
glaceon2000 commentedon Oct 2, 2025
@ArthurHlt Thanks a lot.
glaceon2000 commentedon May 4, 2026
No update?
[web] Stop percent-decoding URLs written to browser history (flutter#…
github-actions commentedon Oct 17, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.[web] Stop percent-decoding URLs written to browser history (flutter#…