TreeNode<T extends Object?> class
An element of a tree. A tree (managed by a controller) contains many nodes. The nodes define the structure of the tree.
identifier should be unique for each node and is usually related to your data. If you have no idea what your identifier should be, you should probably use the TreeNode.auto constructor to automatically assign the node an identifier.
Constructors
-
TreeNode(Object identifier, T data, {bool draggable = true, List<
TreeNode< ? children, bool expanded = true})Object?> > - Create a TreeNode.
-
TreeNode.auto(T data, {bool draggable = true, List<
TreeNode< ? children, bool expanded = true})Object?> > - Create a TreeNode with an automatically assigned unique identifier.
Properties
-
children
↔ List<
TreeNode< Object?> > -
The children of this node
getter/setter pair
- data ↔ T
-
The data contained by this node.
getter/setter pair
- depth ↔ int
-
The depth of this node, starting at 0 depth for the rootnodes of the tree.
getter/setter pair
- draggable ↔ bool
-
A flag indicating if the node can be dragged.
getter/setter pair
- expanded ↔ bool
-
A flag indicating if the node should be expanded in the ui.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- identifier → Object
-
The identifier of this node.
final
- index → int
-
The index this node has in its sibling array
no setter
- isAttached → bool
-
A flag indicating if this node is attached to a tree controller.
no setter
- isBeingDragged ↔ bool
-
A flag indicating if the node is being dragged by the user.
getter/setter pair
- isNotParent → bool
-
A flag indicating if this node is not a parent node (so a node with no child nodes)
no setter
- isParent → bool
-
A flag indicating if this node is a parent node (so a node with children)
no setter
-
parent
→ TreeNode<
Object?> ? -
The parent of this node
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
siblings
→ List<
TreeNode< Object?> > -
The siblings of this node
no setter
Methods
-
attachChild<
U> (TreeNode< U> child, {int? index, bool notify = true}) → void - A method to attach a child to this node. Use this to attach new nodes to the tree.
-
attachSibling<
U> (TreeNode< U> node, {int? index, bool notify = true}) → void -
Adds a sibling next to
thisnode or atindexif it is specified. Use this to attach new nodes to the tree. -
collapse(
{bool notify = true}) → void - Collapse this node in UI's.
-
expand(
{bool notify = true}) → void - Expand this node in UI's.
-
move(
int index, {TreeNode< Object?> ? newParent, bool notify = true}) → void -
Move this node to the
newParentor the root of the tree if nonewParentis supplied -
moveDown(
{bool notify = true}) → void - Move this node down one spot with respect to its siblings.
-
moveUp(
{bool notify = true}) → void - Move this node up one spot with respect to its siblings.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
replaceWith(
TreeNode< Object?> other, {bool notify = true}) → void - Replace this node by another node
-
toggle(
{bool notify = true}) → void - Toggle the expansion of this node in UI's.
-
toString(
) → String -
A string representation of this object.
inherited
-
traverse(
void action(TreeNode< Object?> node)) → void -
Travels this node and all its descendants. Calling back
actionon each node hit.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited