deleteFile method

void deleteFile(
  1. String filePath
)

Implementation

void deleteFile(String filePath) async {
  String fullPath = _getFullPath(filePath);
  if (!_isPathAllowed(fullPath)) {
    sendResponse('550 Access denied');
    return;
  }

  var file = File(fullPath);
  if (await file.exists()) {
    await file.delete();
    sendResponse('250 File deleted');
  } else {
    sendResponse('550 File not found');
  }
}