HTTP Request local network

Dear community,
My name is Volodymyr, I am student at German university. This semester I have a project, where I to develop a Flutter based application.
During development process I have faced an issue, connecting to a device, that is inside my localhost via flutter code. So, I have connected a device to my router network and it has a web-address, that is accessible. However I can’t reach this device by sending simple get requests to that device.
Tried to send similar request using Java, worked from first time.

I have used:
import ‘package:http/http.dart’;
import ‘package:wifi/wifi.dart’;

Launching on android emulator, defined static IP to, did not helped.

Did somebody faced similar issue or know how to solve? Your advices will help me a lot and I am really looking forward to them.

Best regards,

Hello and welcome,
it would greatly increase the chances to understand the origin of you issue if you could post the relevant part of your code (the one making the failing http request). Menawhile we can only guess. I.e. did you already check the following resource?


Hi patrick_dm,
Here is the code I was trying to launch:

void blinky() async {
  String url = 'http://3c393_air-q.local/blink';//link to device, that is inside my local network
  var response = await http.get(url);

the url is an insecure HTTP connection, I’d try the instructions in the guide linked in previous post… i.e ( for debug builds ) :

Allowing cleartext connection for debug builds

If you would like to allow HTTP connections for Android debug builds, you can add the following snippet to your $project_path\android\app\src\debug\AndroidManifest.xml:

<application android:usesCleartextTraffic="true"/>

(a side note: if you own/control the server (is it something like a Raspberry Pi3?) you could serve HTTPS connection with self-signed certificates)


Dear patrick_dm,
Thank you very much for your help! Unfortunately it did not helped. My current $project_path\android\app\src\debug\AndroidManifest.xml looks like:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.FULL INTERNET ACCESS" />

<application android:usesCleartextTraffic="true"/>

I see :confused:… well…
Did you try with the the actual IP address instead of “3c393_air-q.local” in your client code url?

Oh, yeah it helped!!
Thank you very much :slight_smile:
I will then have to do some research, how to get wifi connections to get IP of that device in the future :slight_smile:

May be do know, a flutter package, that I can analyse connections of my wifi to get list of IP’s?
Because that IP can be changed over time…

Yes, I was thinking about that… I’d have a look at