SocketException:操作系统错误:连接被拒绝,errno = 111,地址= localhost,端口= 37312,同时发布了HTTP

问题描述

我正在尝试将数据从Flutter发送到Node API。我的代码如下。

.PPNameHeader{
   ...
   font-size: 1.173rem;
   font-family: 'Gilroy-Bold';
}

出现以下错误

enter image description here

解决方法

您需要更改localhost。它应该是您的IP地址。

     final String uri = "http://10.0.2.2:3000";

Github上查找相同的问题。

,

在终端中运行以下命令

adb reverse tcp:3000 tcp:3000