deleteFile function

bool deleteFile(
  1. String path
)

Delete a file with the given path

Implementation

bool deleteFile(String path) {
  final file = File(path);
  if (!file.existsSync()) {
    return false;
  }
  try {
    // Delete the file
    file.deleteSync();
    return true;
  } catch (e) {
    logger.e('Error deleting file', error: e);
  }

  return false;
}