flutter web run on custom port

Hi Guys, Welcome to Proto Coders Point. In this article will learn how to run flutter web app on specified port number.

Flutter web change port number

By default, When you run flutter web app on browser localhost, each time app will start on random port number (eg: http://localhost:50465/#/).

Sometimes, In development process you may need to run flutter web app on fixed port, Say your server only accept request from particular port, or you have implement firebase auth services & for security reason you are accepting request only from certain ports), In that case you need to run flutter web app on fixed port.

To do it, will make use of flag '--web-port=<custom port number>'

// run flutter web on custom port 

flutter run -d chrome --web-port=4000

// screenshot below

screenshot flutter web running on custom defined port number