deleteFile static method

void deleteFile(
  1. String path
)

Deletes a file if it exists.

  • path: The file path to delete.

Throws: Any exception encountered during deletion.

Implementation

static void deleteFile(String path) {
  final file = File(path);
  if (file.existsSync()) {
    file.deleteSync();
  }
}