[英]Cant send a post request to my api with flutter
我正在尝试向我的 api 发出发布请求以创建新用户。 我的 api 工作正常,我尝试了所有我能找到的东西。 The output is: Unhandled Exception: Bad state: Insecure HTTP is not allowed by platform: http://10.0.2.2:5000/api/register
我正在使用一个 android 仿真器,我试图在我的 android 手机上使用它没有工作......
如果您想允许 HTTP 请求(默认禁用),您必须在 android 清单文件的应用程序标签中添加此代码:
<application android:usesCleartextTraffic="true"/>
对于 iOS 查看 info.plist 作为源代码并添加以下代码:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.