deleteTempFile static method
Deletes a temporary file with the specified name.
Returns true if the file was deleted, false if it didn't exist.
Implementation
static Future<bool> deleteTempFile(String name) async {
try {
if (_tempFiles.containsKey(name)) {
final filePath = _tempFiles[name]!;
final file = File(filePath);
if (await file.exists()) {
await file.delete();
_tempFiles.remove(name);
return true;
}
}
return false;
} catch (e) {
Error.throwWithStackTrace(
HTTPSException(
message: 'Failed to delete temporary file $name: ${e.toString()}',
originalError: e,
),
StackTrace.current,
);
}
}