download method
- ReleaseArtifact release
Initiates the downloading of the provided release
.
Implementation
Future<void> download(ReleaseArtifact release) async {
final releaseDownload = ReleaseDownload(release.url);
activeDownload.value?.cancel();
activeDownload.value = releaseDownload;
try {
await activeDownload.value?.start();
activeDownload.value = releaseDownload;
} on DioException catch (e) {
if (e.type == DioExceptionType.cancel) {
activeDownload.value?.cancel();
activeDownload.value = null;
} else {
activeDownload.value?.cancel();
activeDownload.value = null;
MessagePopup.error(e);
rethrow;
}
} catch (e) {
activeDownload.value?.cancel();
activeDownload.value = null;
MessagePopup.error(e);
rethrow;
}
}