TreeNode<T> constructor

TreeNode<T>({
  1. required Widget label,
  2. T? value,
  3. Icon? icon,
  4. Widget trailing(
    1. BuildContext context,
    2. TreeNode<T> node
    )?,
  5. dynamic data,
  6. bool isSelected = false,
  7. List<TreeNode<T>>? children,
})

Creates a TreeNode.

The label parameter is required and specifies the widget to display for this node.

The value parameter is an optional value associated with this node.

The icon parameter specifies the icon to display next to the node.

The trailing parameter specifies the widget to display after the node.

The data parameter is an optional map of extra data associated with this node.

The isSelected parameter controls the initial selection state of the node.

The children parameter is an optional list of child nodes.

Implementation

factory TreeNode({
  required Widget label,
  T? value,
  Icon? icon,
  Widget Function(BuildContext context, TreeNode<T> node)? trailing,
  dynamic data,
  bool isSelected = false,
  List<TreeNode<T>>? children,
}) {
  return TreeNode._internal(
    label: label,
    value: value,
    icon: icon,
    trailing: trailing,
    data: data,
    children: children ?? [],
    isSelected: isSelected,
  );
}