delete method

void delete(
  1. String path
)

Deletes a file or directory if it exists.

Implementation

void delete(String path) {
  try {
    if (FileSystemEntity.isFileSync(path)) {
      File(path).deleteSync();
    } else if (FileSystemEntity.isDirectorySync(path)) {
      Directory(path).deleteSync(recursive: true);
    }
  } catch (e) {
    throw CliException('Failed to delete entity at $path', e);
  }
}