How to deploy flutter web on server? How to deploy flutter web on server? dart dart

How to deploy flutter web on server?


[UPDATE]

To create a production build for web now Flutter supports flutter build web command similar to other platforms (android and ios)and you will see

build/web

folder generated with the source files mainly index.html,main.dart.js and the assets folder and you can simply deploy it on your server,

[OLD ANSWER STEP 1 & 2 No longer required ]

you simply need to do a production build by using a webdev tool.to install webdev you need a pub tool,

  1. so go to the location where you have dart SDK installed and inside the bin folder you should have a pub batch file. You need to provide the bin folder's path to the environment variable in order to use pub from cmd.

  2. now open cmd and hit the below command to install webdev

    pub global activate webdev

    // in your intelliJ Idea terminal

  3. now go to the root folder of your project and do a build in release mode

    flutter build web

  4. you should see a build folder (/build/web) in the root directory, just copy that folder and host it on a web server.

I used the same way to deploy it to GitHub pages here's how in detail guide.

Some useful link: https://dart.dev/tools/webdev#build

Here's the running flutterweb app


if you want to use your own server over web e.q your virtual private host or other host over net :

go to the root folder of your project and do a build in release mode flutter build web,then

upload (/build/web)directory to your server ,you can follow this link and configure IIS on windows server.


Here is the simple way to deploy your flutter web application on amazon web server.

Following is the simple process i follow.

  1. Build flutter web: flutter build web —release
  2. Create instance on aws ec2 server: mean allocate some memory foryour website on server. Instance is the virtual server in aws cloud.
  3. Connect to your server(instance) with the help of putty :
  4. Install Vesta control panel on your server. (you can install other control panel too if you don't like vesta).
  5. Upload your content(website) on server.(With the help ofFileZilla you can easily uploadyour website content on server)

Here is the simple video tutorial:https://youtu.be/htuHNO9JeRU