TreeItemNode<T> constructor

TreeItemNode<T>({
  1. required T data,
  2. List<TreeNode<T>> children = const [],
  3. bool expanded = false,
  4. bool selected = false,
})

Creates a TreeItemNode with the specified data and configuration.

Constructs a tree item node with user data and optional children, expansion state, and selection state.

Parameters:

  • data (T, required): The data value to store in this tree item
  • children (List<TreeNode<T>>, default: []): Child nodes list
  • expanded (bool, default: false): Initial expansion state
  • selected (bool, default: false): Initial selection state

Example:

// Simple leaf item
TreeItemNode<String> leaf = TreeItemNode(data: 'Leaf Node');

// Parent with children
TreeItemNode<String> parent = TreeItemNode(
  data: 'Parent Node',
  expanded: true,
  children: [
    TreeItemNode(data: 'Child 1'),
    TreeItemNode(data: 'Child 2'),
  ],
);

Implementation

TreeItemNode({
  required this.data,
  this.children = const [],
  this.expanded = false,
  this.selected = false,
});