deleteDirectory method

  1. @override
Future<void> deleteDirectory(
  1. String path
)
override

Deletes the directory at the specified path.

Implementation

@override
Future<void> deleteDirectory(String path) async {
  final dirPath = resolvePath(path);
  if (dirPath == rootDirectory) {
    throw FileSystemException("Cannot delete root directory", path);
  }
  final dir = Directory(dirPath);
  if (await dir.exists()) {
    await dir.delete(recursive: true);
  } else {
    throw FileSystemException(
        "Directory not found for deletion: $path (resolved to $dirPath)");
  }
}