download method
Implementation
Future<String> download({required String savePath, OnProgress? onProgress}) async {
return await _dio.download(
url,
savePath,
cancelToken: _token,
queryParameters: queryParameters,
onReceiveProgress: (int count, int total) {
if (onProgress != null) {
double progress = (count * 100 ~/ total).toDouble();
onProgress(progress);
}
},
).then((response) {
return savePath;
}).catchError((e) {_handleError(e);});
}