Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 颤振Http post调用不';不能在网络上工作,只能在手机上工作_Flutter_Http_Dart_Web - Fatal编程技术网

Flutter 颤振Http 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

有什么解决办法吗?谢谢

我建议您尝试使用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
        .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);
    }));