delete method
Deletes the file. If the file was deleted, returns true. If the file did not exist, return false.
Implementation
Future<bool> delete() async {
_checkIfFileSystemIsTheSame();
File file = _file ?? await this.file();
if (file.existsSync()) {
try {
file.deleteSync(recursive: true);
return true;
} catch (error) {
if ((error is FileSystemException) && //
error.message.contains("No such file or directory")) return false;
rethrow;
}
} else
return false;
}