download method
Implementation
Future<DownloadClientData> download({
required Uri url,
Directory? directoryDownload,
String? newFileName,
bool isAutoDeleteDownloadClientData = true,
required FutureOr<dynamic> Function(double proggres, File file) onProggres,
required FutureOr<dynamic> Function(DownloadClientData downloadClientData)
onDone,
}) async {
DownloadClientData? downloadClientData = getDownloadClientData(uri: url);
if (downloadClientData == null) {
downloadClientData = await downloadRaw(
url: url,
directoryDownload: directoryDownload,
newFileName: newFileName,
isAutoDeleteDownloadClientData: isAutoDeleteDownloadClientData,
onProggres: onProggres,
onDone: onDone,
);
download_client_datas.add(downloadClientData);
return downloadClientData;
} else {
if (downloadClientData.is_complete()) {
if (isAutoDeleteDownloadClientData) {
deleteDownloadClientData(uri: url);
}
}
return downloadClientData;
}
}