buildTree method
Implementation
buildTree(NodePath nodePath) {
if (nodePath.path.isEmpty) return;
var count = nodePath.path.length;
TreeNode current = _root;
nodePath.path.asMap().forEach((idx, value) {
TreeNode node;
if (idx == count - 1) {
node = TreeNode(value, nodePath.value, idx);
} else {
node = TreeNode(value, null, idx);
}
current = current.addChild(node);
});
}