侦听数据时出现HttpClientResponse错误 [英] HttpClientResponse Error while Listen Data

查看:81
本文介绍了侦听数据时出现HttpClientResponse错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 HttpClientResponse 得到响应,然后尝试执行以下监听:

I get response from HttpClientResponse After that trying to perform listen like:

//... your code
response.transform(utf8.decoder).listen( (data) {
   //... your code
})
//... your code



< h2>错误

Error(s)

The argument type 'Utf8Decoder' can't be assigned to the parameter type 'StreamTransformer<Uint8List, dynamic>'



一些额外的详细信息




  • 4cd12fc8b上颤振提交

  • 以前运行正常。

  • 推荐答案

    此实现在修复流处理中的错误后已更改。

    This implementation is changed after fixing a bug in Stream handling.

    以下是Flutter社区提出的更改请求- https:// github。 com / dart-lang / sdk / issues / 36900

    Following is the changed request raised in Flutter community - https://github.com/dart-lang/sdk/issues/36900

    您可以通过以下更改来解决此问题

    You can fix this issue with following changes

    request.close().then((response){
      response.cast<List<int>>().transform(utf8.decoder).listen((content) {
            return content;
          });
    });
    

    供参考:> https://github.com/dart-lang/co19/pull/384

    这篇关于侦听数据时出现HttpClientResponse错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆