How to deploy flutter web on Heroku

Viewed 4051

I built a web application in Flutter and run the command flutter build web successfully. I'm trying to find a way to deploy it on Heroku like my react applications but found nothing in Heroku documentation.

2 Answers

we run flutter web or static page run with the help of php.we can use many other language .we can simply use php without any more work.
First create app in heroku after this will shown .enter image description here

after run flutter build web in the root of the project folder it will generate static content in build/web .copy the file to any other directory and open cmd like this

enter image description here

create two file index.php and composer.json in index.php add this

<?php include_once("index.html"); 

in composer.json add this (braces)
{} 

enter image description here

after run the command in the

`heroku login`
heroku git:clone -a appname
git add .
git commit -am "make it better
git push heroku master

after running this it may be show any error .if not show any error run this https://appname.herokuapp.com/#/ .your website will be live.

Try these simple steps. first, you need to create your app on Heroku, after typing the commands in your project directory console

  1. heroku login
  2. git init
  3. heroku git:remote -a [your app name in heroku]
  4. git commit -m "[your commit message]"
  5. heroku buildpacks:set diezep/flutter -a [your app name]
  6. git push heroku master
Related