deleteDirectory static method
递归删除目录。
Implementation
static Future<void> deleteDirectory(Directory dir) async {
final List<FileSystemEntity> entities = await dir.list().toList();
for (final FileSystemEntity entity in entities) {
if (entity is File) {
await entity.delete();
} else if (entity is Directory) {
await deleteDirectory(entity);
}
}
await dir.delete();
}