TreeItemNode<T> constructor
TreeItemNode<T> ({})
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 itemchildren(List<TreeNode<T>>, default: []): Child nodes listexpanded(bool, default: false): Initial expansion stateselected(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,
});