简体   繁体   English

在颤振中进行 json api 调用时出错

[英]Error while making json api call in flutter

I am facing below error我面临以下错误

Unhandled Exception: SocketException: Insecure socket connections are disallowed by platform: 111.11.111.11

while executing the below json api call to the server in flutter application在 flutter 应用程序中对服务器执行以下 json api 调用时

var response = await http.post(loginapiUrl, body: data);

I cannot configure https:// for my url.我无法为我的 url 配置https:// please provide me the solution请为我提供解决方案

Add network configuration in Android and iOS respectively as you are acessing the Insecure Connections.当您访问不安全连接时,分别在 Android 和 iOS 中添加网络配置。

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="false">
        <domain includeSubdomains="true">secure.example.com</domain>
    </domain-config>
</network-security-config>

In respective folder add those thing inside the AndroidManifest.在相应的文件夹中,将这些内容添加到 AndroidManifest 中。

For more instruction follow this.有关更多说明,请遵循此。

https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM