错误:
lib/http/http_request.dart:23:64: Error: The argument type 'Utf8Decoder' can't be assigned to the parameter type 'StreamTransformer<Uint8List, dynamic>'.
出错代码:
var response = await request.close();
var responseBody = await response.transform(Convert.utf8.decoder).join();
解决问题:
var response = await request.close();
替换为:
final response = await request.close().then((response){
response.cast<List<int>>().transform(Convert.utf8.decoder).listen((content) {
return content;
});
});