dartlocalhostvirtualhostembedded-server

Access dart embedded webserver from other devices on same network


I am new to dart web and and now i am trying to access my web-page from other devices on same network .

When i enter command webdev serve , an embedded web-server listens on port 8080 and I can access that via 127.0.0.1:8080 on that device . but i can not access that from other devices on same network with <DeviceLocalIP>:<port>

In the past i tried to access Wamp VirtualHost from other devices and that worked this way . Please help .


Solution

  • By default, webdev listens on 127.0.0.1 which is a special address that means 'listen on this device only'. To access your web page from another device you'll need to use the --hostname flag to specify the hostname or IP address of your computer, or you can use 0.0.0.0 to listen on all interfaces, i.e.

    webdev serve --hostname 0.0.0.0