在 flutter web 上,当我在 Chrome 上重新加载页面时,我收到文本“未找到”。我该如何修复它?这是我的 main.dart 代码。我还注意到,要直接访问页面,我必须在 URL 中插入井号 (#),如下所示:“ http://127.0.0.1:8080/#/homepage ”。有办法去除吗?
class MyApp extends StatefulWidget {
const MyApp({Key key}): super(key: key);
@override
MyAppState createState() => MyAppState();
}
class MyAppState extends State<MyApp> {
// This widget is the root of your application.
@override
void initState() {
html.window.history.pushState(null, "Home", "/");
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
initialRoute: "/",
theme: ThemeData(
primarySwatch: Colors.blue,
fontFamily: 'GoogleSansRegular'
),
routes: {
"/": (context) => HomePage(),
"/homepage": (context) => …Run Code Online (Sandbox Code Playgroud)