getChildren method

Stream<VEntity> getChildren(
  1. VFolder folder
)

Implementation

Stream<VEntity> getChildren(VFolder folder) async* {
  if (!_childrenCache.containsKey(folder.path)) {
    List<String> children = [];
    await for (VEntity entity in onGetChildren(folder)) {
      children.add(entity.path);
      _cache[entity.path] = entity;
    }

    _childrenCache[folder.path] = children;
  }

  List<VEntity> v = await Stream.fromFutures(
          _childrenCache[folder.path]!.map((i) => getEntity(i)))
      .whereType<VEntity>()
      .toList();
  v.sort(isComparatorReversed
      ? currentComparator.compareReversed
      : currentComparator.compare);
  v.sort(VFSComparatorEntityType().compare);
  yield* Stream.fromIterable(v);
}