downInfo method

Future<void> downInfo(
  1. String url,
  2. String filePath,
  3. VoidCallback onDone, {
  4. VoidCallback? error,
})

Implementation

Future<void> downInfo(String url, String filePath, VoidCallback onDone,
    {VoidCallback? error}) async {
  try {
    DownloadFlow.download(
        url,
        DownloaderUtils(
          progressCallback: (current, url) {
            print("------------下载完成---${url}--------------");
          },
          file: File(filePath),
          progress: ProgressImplementation(),
          onDone: () {
            onDone();
          },
          error: () {
            error?.call();
          },
          deleteOnCancel: true,
        ));
  } catch (msg) {
    error?.call();
    print(msg);
  }
}