Reputation: 584
I have this code
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) + "%";
});
}
});
Like onReceiveProgress, do we have any other callback for 'Download Complete'?
Upvotes: 1
Views: 1177
Reputation: 11984
The future it returns is the callback.
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!");
Upvotes: 1