'request on server with a HTTP REST Endpoint not working SocketException errno 64

I am trying to connect to an endpoint (no internet Wi-Fi) and than do some get post requests, I tried multiple libraries http dio etc .. but no positive results. and when I try the same url "http://192.168.4.1:80/getDetails" or "http://192.168.4.1/getDetails" on the browser, it works smoothly. and also when I try an open url on the app (but online) it works fine. I suspect there is a problem with the library or I did miss something to add to my code to can do the request to the endpoint even if it is offline, any suggestions guys.

I am running the app on real device android 11 and here is a code that I tried :

   var httpClient = http.Client();
   var url = Uri.parse("http://192.168.4.1:80/getDetails");
   await this.httpClient.get(url, headers: <String, String>{
       'Content-Type': 'application/json; charset=UTF-8',
       'Accept': "*/*",
       'connection': 'keep-alive',
       'Accept-Encoding' : 'gzip, deflate, br',
     },);```


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source