how to run flutter web build locally

 

On Mac

Run the following terminal command to start up an apache server:

sudo apachectl start

Then, move the contents of your build/web folder to /Library/WebServer/Documents/

(Note: Index.html base href should be "/" if you had previously modified it)

Now, navigate web browser to localhost

Once done, kill the apache server with the following command:

sudo apachectl graceful-stop


On Windows

Download XAMPP, install, allow it to run on local networks if prompted, then launch the XAMPP app (it will likely have launched on its own).

In the XAMPP app, find the row for "Apache" and click the "Start" button to start up the web server

Move the contents of your build/web folder to C:/xampp/htdocs/

(Note: Index.html base href should be "/" if you had previously modified it)

Now navigate web browser to 127.0.0.1/index.html

Once done, open the XAMPP app and click "stop" on the Apache row.

Post a Comment

Previous Post Next Post

Subscribe Us


Get tutorials, Flutter news and other exclusive content delivered to your inbox. Join 1000+ growth-oriented Flutter developers subscribed to the newsletter

100% value, 0% spam. Unsubscribe anytime