2022年11月14日星期一

flutter build web

 48

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

  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. open cmd/terminal run the below command to install webdev

    pub global activate webdev

  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.



Remove this Line or remove '/' from the href attribute.

<base href="/">

沒有留言:

發佈留言