我正在使用带有dio包的flutter下载powerpoint和视频等文件...
我想问的是如何在后台下载大文件
try {
await dio.download(
fileURL, '$dir/$fileName.pptx',
onReceiveProgress: showDownloadProgress,
deleteOnError: true);
print("BBBB");
openDownloadedFile = '$dir/$fileName.pptx';
print("CCCC");
} on DioError catch(e) {
print("11");
final file = File('$dir/$fileName.pptx');
file.deleteSync(recursive: true);
if(e.response != null) {
print("22");
print(e.response.data);
print(e.response.headers);
print(e.response.request);
} else{
// Something happened in setting up or sending the request that triggered an Error
print(e.request);
print(e.message);
}
}
最好的问候