【发布时间】:2023-02-24 13:33:01
【问题描述】:
我正在尝试通过我的 Flutter 桌面应用程序连接到我的 localhost:8080,但我收到此错误
“未处理的异常:远程计算机拒绝网络连接。”
这是我的代码:
class LoginRequestCall {
static Future<ApiCallResponse> call({
String? userName = '',
String? password = '',
}) {
return ApiManager.instance.makeApiCall(
callName: 'loginRequest',
apiUrl: 'http://localhost:8080/HongLeong/LOGIN_REQUEST.do',
callType: ApiCallType.POST,
headers: {},
params: {
'UserName': userName,
'Password': password,
},
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
returnBody: true,
);
}
static dynamic messageID(dynamic response) => getJsonField(
response,
r'''$.RESPONSE.BASEL_RESPONSE.ErrEntity.MessageID''',
);
static dynamic userName(dynamic response) => getJsonField(
response,
r'''$.RESPONSE.BASEL_RESPONSE.UserName''',
);
static dynamic serverName(dynamic response) => getJsonField(
response,
r'''$.RESPONSE.RESPONSE_HEADER.server_name''',
);
}
任何解决方案将不胜感激。
【问题讨论】:
标签: flutter api dart networking localhost