Flutter 颤振Http post调用不';不能在网络上工作,只能在手机上工作
有什么解决办法吗?谢谢我建议您尝试使用dio软件包(),它在我的web项目中起作用。您能提供使用dio的post方法的代码示例吗?下面是来自软件包发布页面的一个示例:Flutter 颤振Http post调用不';不能在网络上工作,只能在手机上工作,flutter,http,dart,web,Flutter,Http,Dart,Web,有什么解决办法吗?谢谢我建议您尝试使用dio软件包(),它在我的web项目中起作用。您能提供使用dio的post方法的代码示例吗?下面是来自软件包发布页面的一个示例:response=wait dio.post('http://www.dtworkroom.com/doris/1/2.0.0/test,数据:{'aa':'bb'*22})您可以在此处找到更多信息: loginUser(email, password) async { var url = Uri.parse
response=wait dio.post('http://www.dtworkroom.com/doris/1/2.0.0/test,数据:{'aa':'bb'*22})代码>您可以在此处找到更多信息:
loginUser(email, password) async {
var url = Uri.parse
.call("https://us-central1-agenie-webapp.cloudfunctions.net/api/login");
final http.Response response = await http.post(
url,
headers: <String, String>{
'Content-Type': 'application/json',
},
body: jsonEncode(<String, String>{'email': email, 'password': password}),
);
if (response.statusCode == 200) return response.body;
return null;
}
unawaited(xhr.onError.first.then((_) {
// Unfortunately, the underlying XMLHttpRequest API doesn't expose any
// specific information about the error itself.
completer.completeError(
ClientException('XMLHttpRequest error.', request.url),
StackTrace.current);
}));