download method

Future<ZResponse> download(
  1. DownloadRequest request, {
  2. OnStart? onStart,
  3. OnProgress? onProgress,
})

Implementation

Future<ZResponse> download(DownloadRequest request,
    {OnStart? onStart,
      OnProgress? onProgress}) async {
  // var a = ZRequest(path: "", body : "", queryParameters: null, options : null);
  dio.Response response = await dio.Dio().download(
    request.path,
    request.savePath,
    options: request.options,
    queryParameters: request.queryParameters,
    onReceiveProgress: (count, total) {
      // TODO speed
      onProgress?.call(count, total, -1);
    },
  );
  return ZResponse(request: request, response: response);
}