由于某些未知原因,我無法連接到物理設備上的本地端點。
代碼:
String url = 'http://localhost/eltriodigital/public/api/prueba';
String url2 = 'http://192.168.56.1/eltriodigital/public/api/prueba';
String url3 = 'https://ecleectic.com/api/prueba';
Future<Response> prueba() async {
Response response =
await get(url, headers: {'Content-type': 'application/json'});
return response;
}
我進行過的測驗:
如果我嘗試連接到生產端點(url3),它可以作業。
如果我嘗試連接到本地端點(url,url2)但從模擬器它可以作業。
如果我嘗試從flutter web連接到本地端點(url,url2),如果它有效。
有人能告訴我為什么我不能從本地端點(url,url2)中的物理設備連接嗎?謝謝
uj5u.com熱心網友回復:
你能檢查一下這個問題 如何從我的 Android 設備訪問我的本地主機? 它可能為您的問題提供解決方案
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/489275.html
上一篇:如何正確匯入彎曲的導航欄?
