Flutter 颤振:错误内容大小低于指定的contentLength

Flutter 颤振:错误内容大小低于指定的contentLength,flutter,Flutter,我尝试使用以下代码将多个图像(在单个密钥“文件”中)上载到API: var stream1 = new http.ByteStream(DelegatingStream.typed(photo1Compressed.openRead())); var length1 = await photo1Compressed.length(); var stream2 = new http.ByteStream(DelegatingStream.typed(photo2Compressed.openRea

我尝试使用以下代码将多个图像(在单个密钥“文件”中)上载到API:

var stream1 = new http.ByteStream(DelegatingStream.typed(photo1Compressed.openRead()));
var length1 = await photo1Compressed.length();
var stream2 = new http.ByteStream(DelegatingStream.typed(photo2Compressed.openRead()));
var length2 = await photo2Compressed.length();
var stream3 = new http.ByteStream(DelegatingStream.typed(photo3Compressed.openRead()));
var length3 = await photo3Compressed.length();
var stream4 = new http.ByteStream(DelegatingStream.typed(photo4Compressed.openRead()));
var length4 = await photo4Compressed.length();
var stream5 = new http.ByteStream(DelegatingStream.typed(photo5Compressed.openRead()));
var length5 = await photo5Compressed.length();
var stream6 = new http.ByteStream(DelegatingStream.typed(photo6Compressed.openRead()));
var length6 = await photo6Compressed.length();
var stream7 = new http.ByteStream(DelegatingStream.typed(photo7Compressed.openRead()));
var length7 = await photo7Compressed.length();
var stream8 = new http.ByteStream(DelegatingStream.typed(photo8Compressed.openRead()));
var length8 = await photo8Compressed.length();

request.files.add(http.MultipartFile('file', stream1, length1, filename: basename(photo1Compressed.path)));
request.files.add(http.MultipartFile('file', stream2, length2, filename: basename(photo2Compressed.path)));
request.files.add(http.MultipartFile('file', stream3, length3, filename: basename(photo3Compressed.path)));
request.files.add(http.MultipartFile('file', stream4, length4, filename: basename(photo4Compressed.path)));
request.files.add(http.MultipartFile('file', stream5, length5, filename: basename(photo5Compressed.path)));
request.files.add(http.MultipartFile('file', stream6, length6, filename: basename(photo6Compressed.path)));
request.files.add(http.MultipartFile('file', stream7, length7, filename: basename(photo7Compressed.path)));
request.files.add(http.MultipartFile('file', stream8, length8, filename: basename(photo8Compressed.path)));
我要么得到这个

我上传的方式有问题吗?我用邮递员测试了这些照片,效果很好

Error Content size below specified contentLength.  1221314 bytes written but expected 1272310.