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

7,035

Solution 1

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.

Solution 2

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

Share:
7,035
Yakub Pasha
Author by

Yakub Pasha

MySelf Yakub, Head of Mobile Technologies @AbhiBus, Hyderabad, Currently on Flutter and having exposure and hands-on experience on Android and iOS native app development besides that worked on Python, AWS, Alexa skill development, Firebase, Nodejs, React js and jQuery.

Updated on December 12, 2022

Comments

  • Yakub Pasha
    Yakub Pasha over 1 year

    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.

  • Mankeomorakort
    Mankeomorakort over 3 years
    You save my day :)
  • AnV
    AnV almost 3 years
    this command is not working. It says "Target file "web-server" not found". If we remove chrome between -d and --web-hostname, it is working.