delete method

Future<void> delete(
  1. VEntity entity
)

Implementation

Future<void> delete(VEntity entity) async {
  if (entity is VFolder) {
    List<Future> work = [];

    for (VEntity child in await getChildren(entity).toList()) {
      work.add(delete(child));
    }

    await Future.wait(work);
    await onDeleteEmptyFolder(entity);
    error("DELETE FOLDER ${entity.path}");
    return;
  } else if (entity is VFile) {
    await onDeleteFile(entity);
    error("DELETE FILE ${entity.path}");
  }
}