insertAllAtFront method

void insertAllAtFront(
  1. NodeData? parent,
  2. List<NodeData> newNodes, {
  3. bool closeCanInsert = false,
})

Appends all nodes to the head of parent. parent The parent node newNode The node will be insert closeCanInsert Can insert when parent closed

Implementation

void insertAllAtFront(NodeData? parent, List<NodeData> newNodes,
    {bool closeCanInsert = false}) {
  if (!closeCanInsert) {
    if (parent != null && !isExpanded(parent)) {
      return;
    }
  }
  parent!.children.insertAll(0, newNodes);
  _insertAllItemAtIndex(0, parent, newNodes);
  notifyListeners();
}