12

Change the default IP(127.0.0.1) of flutter web App.

I have created a flutter web application, when I run the web app the ip which assigned is 127.0.0.1 but i am unable to access the same app with my local IP over LAN. So please help on how can i change this.

Yakub Pasha
  • 483
  • 1
  • 5
  • 19

2 Answers2

26

update

webdev is no longer used for launching flutter web applications. Now use:

 flutter run -d web-server --web-hostname 0.0.0.0 --web-port 8989

original answer

Start the app with command:

webdev server --web-hostname 0.0.0.0

Or replace 0.0.0.0 with your actual ip address.

Spatz
  • 18,640
  • 7
  • 62
  • 66
9

You can add this command line parameter --web-hostname 0.0.0.0.

( --hostname doesn't work now. )

So when you start your web server you would start like this :

flutter run -d chrome --web-hostname 0.0.0.0 --web-port 55555

This will allow you to access your web app from any device in your LAN network by accessing the url :

http://your-local-ip:55555

Natesh bhat
  • 12,274
  • 10
  • 84
  • 125