cancel method
Implementation
Future<bool> cancel({required int tokenDownload}) async {
try {
SelectDownload selectDow = checkDownload(tokenDownload);
if (!selectDow.exists) false;
if (selectDow.status!.status == DownloadType.cancelDownload) true;
TokenDownloadStatus status = selectDow.status!;
SelectTask st = _selectIsolate(status.isolateToken);
if (st.exists) {
TaskDownload dw = st.task!;
selectDow.status!.status = DownloadType.cancelDownload;
dw.sendPort.send(ManMessagePort(action: 'cancel'));
return true;
} else {
return false;
}
} catch (e) {
print(e);
return false;
}
}