【发布时间】:2021-07-03 16:00:38
【问题描述】:
我有一个来自 Google Drive 的直接链接,我的应用将下载并显示百分比,它正确下载的任何其他链接,但只有 Google Drive 直接链接显示一个很大的负数。
“Baixando”在葡萄牙语中的意思是“下载”。
await dio.download(
widget.document['url'],
path,
onReceiveProgress: (received, total){
setState(() {
progress = "Baixando..."+((received / total) * 100).toStringAsFixed(0) + "%";
});
});
例如,使用此 Google Drive 直接链接 (pdf):https://drive.google.com/uc?export=download&id=1N8D8lx1HlW0X99wovGEQxZRUtewN6-J2
更新:“received”获取文件的大小(以字节为单位),“total”我只获取值:-1,在尝试下载 Google Drive 直接链接时它不会改变。
【问题讨论】:
-
你用什么库来下载文件?