Flutter报错记录:Error: The argument type 'Utf8Decoder'

导入项目中常常报如下错误

lib/http/http_request.dart:23:64: Error: The argument type 'Utf8Decoder' can't be assigned to the parameter type 'StreamTransformer'.

报错代码

var response = await request.close();
var responseBody = await response.transform(Convert.utf8.decoder).join();

替换为:

final response = await request.close().then((response){
        response.cast>().transform(Convert.utf8.decoder).listen((content) {
          return content;
        });
      });

你可能感兴趣的:(项目纠错)