getChildrensChildren method

Future<Map<String, List<Node>>> getChildrensChildren(
  1. dynamic keys,
  2. dynamic parentPath
)

Implementation

Future<Map<String, List<Node>>> getChildrensChildren(keys, parentPath) async {
  try {
    ///Map with Parant Key  as Key and Children List
    Map<String, List<Node>> childrensChildren = <String, List<Node>>{};
    for (var key in keys) {
      var path = parentPath + ':' + key;
      if (parentPath == ':') {
        path = parentPath + key;
      }
      gls.Node childParent = await api.storage.getNodeOrTombstone(path);
      Map<String, gls.Node> children = await childParent.getChildren();

      ///Map Children GeigerStorageNodes to TreeView Nodes
      List<Node> childrenNodes = children.keys
          .map((k) =>
              Node(key: k, label: children[k]!.path, data: children[k]!.path))
          .toList();

      ///Store List in Map at with Parant Key as Key
      childrensChildren[key] = childrenNodes;
    }
    return childrensChildren;
  } catch (e) {
    return <String, List<Node>>{};
  }
}