TreeItem<T> constructor
TreeItem<T> ({})
Creates a TreeItem 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<TreeNodeexpanded
(bool, default: false): Initial expansion stateselected
(bool, default: false): Initial selection state
Example:
// Simple leaf item
TreeItem<String> leaf = TreeItem(data: 'Leaf Node');
// Parent with children
TreeItem<String> parent = TreeItem(
data: 'Parent Node',
expanded: true,
children: [
TreeItem(data: 'Child 1'),
TreeItem(data: 'Child 2'),
],
);
Implementation
TreeItem({
required this.data,
this.children = const [],
this.expanded = false,
this.selected = false,
});