copyWith method
Implementation
TreeNode<T> copyWith(
{String? key,
T? data,
bool? expanded,
bool? selected,
bool? reorderable,
TreeNode<T>? parent,
List<TreeNode<T>>? children}) {
var copyNode = TreeNode(
key: key ?? this.key,
data: data ?? this.data,
expanded: expanded ?? this.expanded,
reorderable: reorderable ?? this.reorderable,
parent: parent ?? _parent,
);
_children?.forEach((element) {
copyNode.children.add(element.copyWith(parent: copyNode));
});
return copyNode;
}