skip to Main Content

I’m developing a Flutter app with NodeJS API & trying to run it on a physical device; but it gives me the message of "Connectin timed out",

I’m using my IPV4 and I’ve tried to run it on an emulator with the ip 10.0.2.2 and it worked,
So anyone have a solution for that? I’ve been trying for a lot of time

Thanks for help!.

2

Answers


  1. Chosen as BEST ANSWER

    I haven't solve it the right way, but it works I used ngrok package that makes the app working on the global internent just with (node run)

    I call it with https and not http


  2. Your computer and physical device have to be connected to the same Network. To access the webpage from a Physical Device you need to use the IP address of your computer instead of localhost.

    1. Start your NodeJS server on 0.0.0.0:8000 or your default port.
    2. Check your computer’s IP using:
    • ipconfig on Windows
    • ip addr on Linux
    • ifconfig on macOS
    1. Use the IP Address you obtained on the physical device.

    Attaching an example from Windows’s ipconfig

    Wireless LAN adapter Wi-Fi:
    
    Connection-specific DNS Suffix  . : atheesh.org
    Link-local IPv6 Address . . . . . : fe80::ee8c:b3b2:76cb:4930
    IPv4 Address. . . . . . . . . . . : 10.0.0.110
    Subnet Mask . . . . . . . . . . . : 255.255.255.0
    Default Gateway . . . . . . . . . : fe80::be0f:9aff:fe6a:c031
                                        10.0.0.254
    

    Now, On your physical device you’ll be using (maybe IPv4, your choice) http://10.0.0.110:8000 and it’ll work if your physical device is on the same network.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search