downloadFile method

Future downloadFile(
  1. dynamic urlPath,
  2. dynamic savePath, [
  3. dynamic resultDialogConfig,
  4. bool isCancelWhiteList = false,
])

Implementation

Future downloadFile(urlPath, savePath,
    [resultDialogConfig, bool isCancelWhiteList = false]) async {
  Response? response;
  try {
    response = await dio?.download(urlPath, savePath,
        onReceiveProgress: (int count, int total) {
      print("$count $total");
    }, cancelToken: isCancelWhiteList ? whiteListCancelToken : cancelToken);
    return response?.data;
  } catch (e) {
    _catchOthersError(e);
  } finally {
    _showResultDialog(response, resultDialogConfig);
  }
}