open method
Opens a File identified by its checksum
, if downloaded, or otherwise
returns false
.
Implementation
Future<bool> open(String? checksum, int? size) async {
final Downloading? downloading = downloads[checksum];
if (downloading?.file != null) {
final File file = downloading!.file!;
if (await file.exists() && await file.length() == size) {
await OpenFile.open(file.path);
return true;
} else {
downloading.markAsNotStarted();
_downloadLocal?.delete(checksum!);
}
}
return false;
}