insertAtFront method
Insert a node in the head
parent
The parent node
newNode
The node will be insert
closeCanInsert
Can insert when parent closed
Implementation
void insertAtFront(NodeData? parent, NodeData newNode,
{bool closeCanInsert = false}) {
if (!closeCanInsert) {
if (parent != null && !isExpanded(parent)) {
return;
}
}
parent!.children.insert(0, newNode);
_insertItemAtIndex(0, parent);
notifyListeners();
}