Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the default web server ip(127.0.0.1) of Flutter Web app

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.

like image 333
Yakub Pasha Avatar asked Jul 10 '19 09:07

Yakub Pasha


2 Answers

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

like image 199
Natesh bhat Avatar answered Oct 19 '22 07:10

Natesh bhat


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.

like image 27
Spatz Avatar answered Oct 19 '22 06:10

Spatz