flutterherokudeploymentserver

How to deploy flutter web on Heroku


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.


Solution

  • 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.