-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#42598Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.f: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.platform-webWeb applications specificallyWeb applications specifically
Description
With the HashUrlStrategy, we add the hash fragment for all pages, including the home page (i.e. routeName = "/"). This means the landing page of the app always has a trailing /#/ in the URL (e.g. https://gallery.flutter.dev/#/).
One thing we can do to improve this is to have a special case for the / and the empty route name such that they don't add the hash fragment to the URL.
Users can already do this in their apps:
import 'package:flutter/material.dart';
import 'package:flutter_web_plugins/url_strategy.dart';
class MyUrlStrategy extends HashUrlStrategy {
@override
String prepareExternalUrl(String internalUrl) {
final String externalUrl = super.prepareExternalUrl(internalUrl);
if (externalUrl.endsWith('#/')) {
return externalUrl.substring(0, externalUrl.length - 2);
}
return externalUrl;
}
}
void main() {
setUrlStrategy(MyUrlStrategy());
runApp(MyApp());
}This issue is for making this the default behavior of HashUrlStrategy. cc @johnpryan @kevmoo
kevmoo, knaeckeKami, Zazo032, anaisbetts, andrewpmoore and 50 more
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.f: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.platform-webWeb applications specificallyWeb applications specifically