1

我想从 openweathermap API 获取协调基地的当前天气信息。为此,我使用了颤振的 HTTP 包。

当我使用这种方法时,问题就在这里

另一个问题是......我在 Memu App Player 上获得了这些坐标,但在 Real android 设备和 Android Studio 的 Own Emulator 上没有给出。

void getWeatherData()async{
String url = 'http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&appid=331533c0cc2197e929ea79cdb2a70e33';
Response response = await get(Uri.parse(url));
print(response.body);  }

这应该完全给我 API 结果,但是当我运行我的应用程序时它给了我这个错误。

Unhandled Exception: Bad state: Insecure HTTP is not allowed by platform: http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&appid=331533c0cc2197e929ea79cdb2a70e33
4

0 回答 0