如何在Flutter中使用Dio获取Download Complete a file的回调?

How to get the callback of Download Complete a file using Dio in Flutter?

我有这个代码

 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 一样,我们是否有针对“下载完成”的任何其他回调?

未来它returns的回调。

  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!");