updateState method

  1. @override
TreeRoot<T> updateState({
  1. bool? expanded,
  2. bool? selected,
})
override

Creates a new instance with updated expansion and/or selection state.

Returns a new TreeNode instance with the specified state changes while preserving all other properties. This maintains immutability of tree structures.

Parameters:

  • expanded (bool?, optional): New expansion state, or null to keep current
  • selected (bool?, optional): New selection state, or null to keep current

Returns: A new TreeNode<T> instance with updated state

Example:

TreeNode<String> expandedNode = node.updateState(expanded: true);
TreeNode<String> selectedNode = node.updateState(selected: true);
TreeNode<String> both = node.updateState(expanded: true, selected: true);

Implementation

@override
TreeRoot<T> updateState({
  bool? expanded,
  bool? selected,
}) {
  return this;
}