[UPDATE]
To create a production build for web, you can now directly run flutter build web command similar to other platforms (android and ios)
and you will see build/web folder generated with the assets folder and you can simply deploy it on your server.
[OLD ANSWER STEP 1 & 2 No longer required ]
you need to do a production build by using a webdev tool,
To install webdev you need a pub tool.
-
so go to the location where you have dart
SDKinstalled 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. -
open cmd/terminal run the below command to install
webdevpub global activate webdev -
now go to the root folder of your project and do a build in release mode
flutter build web -
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