download static method
download file
Implementation
static Future<void> download({
required String url,
required String savePath,
Function(ApiException error)? onError,
Function(int value, int progress)? onReceiveProgress,
required Function onSuccess,
}) async {
try {
await _dio.download(
url,
savePath,
options: Options(
receiveTimeout: const Duration(seconds: _timeoutInSeconds),
sendTimeout: const Duration(seconds: _timeoutInSeconds),
),
onReceiveProgress: onReceiveProgress,
);
onSuccess();
} catch (error) {
onError?.call(ApiException(url: url, message: "DOWNLOAD_EXCEPTION"));
}
}