如何在 Heroku 上部署 flutter web

Tia*_*mas 6 deployment heroku web server flutter

我在 Flutter 中构建了一个 Web 应用程序并成功运行了命令flutter build web。我正在尝试找到一种将其部署在 Heroku 上的方法,就像我的 React 应用程序一样,但在 Heroku 文档中找不到任何内容。

lav*_*ava 2

我们在 php 的帮助下运行 flutter web 或静态页面。我们可以使用许多其他语言。我们可以简单地使用 php 而无需任何其他工作。
首先在 Heroku 中创建应用程序,然后将显示此内容。在此输入图像描述

在项目文件夹的根目录中运行后,flutter build web它将在 build/web 中生成静态内容。将文件复制到任何其他目录并像这样打开 cmd

在此输入图像描述

在index.php中创建两个文件index.php和composer.json添加此

<?php include_once("index.html"); 
Run Code Online (Sandbox Code Playgroud)
在composer.json中添加这个(大括号)
{} 
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

运行命令后

`heroku login`
heroku git:clone -a appname
git add .
git commit -am "make it better
git push heroku master
Run Code Online (Sandbox Code Playgroud)

运行此命令后,可能会显示任何错误。如果没有显示任何错误,请运行此https://appname.herokuapp.com/#/。您的网站将上线。