insertAtRear method
Insert a node in the end
parent The parent node
newNode The node will be insert
closeCanInsert Can insert when parent closed
Implementation
void insertAtRear(NodeData? parent, NodeData newNode,
{bool closeCanInsert = false}) {
if (!closeCanInsert) {
if (parent != null && !isExpanded(parent)) {
return;
}
}
if (parent == null) {
data!.add(newNode);
_insertRootControllerAt(data!.length - 1);
} else {
parent.children.add(newNode);
_insertItemAtIndex(0, parent, isFront: false);
}
notifyListeners();
}