如何像 html 文件一样在浏览器中打开 flutter web 应用程序

How to open flutter web app in browser just like a html file

我正在尝试 flutter web,我想和我的朋友分享我构建的东西,所以我想知道如何让我的 flutter web 应用程序在浏览器中打开和 运行 就像 html文件,您只需单击该文件并使用 chrome 打开它,网站就会加载

不能直接打开flutter web工程

这是因为 flutter build web 将生成单页应用程序或 SPA 除非通过服务器托管,否则将无法运行。

用户必须 运行 本地服务器才能查看页面,为此您可以使用 python 3 的 http.serve 命令或 dart 变体 dhttpd,如果无法使用本地服务器,您可以使用 firebasenetlify 等托管解决方案来托管您的应用程序。