我有这个代码
await dio.download(fileUrl, "${fileDir.path}/$fileName",
onReceiveProgress: (received, total) {
if (total != -1) {
print("Rec: $received , Total: $total");
debugPrint("Directory path : " + filePath + "/" + fileName);
setState(() {
downloadProgressString =
((received / total) * 100).toStringAsFixed(0) + "%";
});
}
});
像 onReceiveProgress 一样,我们是否还有其他用于“ 下载完成”的回调?
答案 0 :(得分:1)
将来返回是回调。
await dio.download(fileUrl, "${fileDir.path}/$fileName",
onReceiveProgress: (received, total) {
if (total != -1) {
print("Rec: $received , Total: $total");
debugPrint("Directory path : " + filePath + "/" + fileName);
setState(() {
downloadProgressString =
((received / total) * 100).toStringAsFixed(0) + "%";
});
}
});
// HERE
print("download complete!");