TreeNode<T> class

A TreeNode that can be used with the TreeView.

To use your own custom data with TreeView, wrap your model T in TreeNode like this:

  class YourCustomNode extends TreeNode<CustomClass> {
  ...
  }
Inheritance
Mixed-in types

Constructors

TreeNode({T? data, String? key, Node? parent})
A TreeNode constructor that can be used with the TreeView. Any data of type T can be wrapped with TreeNode
TreeNode.root({T? data})
Factory constructor to be used only for root TreeNode
factory

Properties

addedNodes → Stream<NodeAddEvent<INode>>
Listen to this Stream to get updates on when a Node or a collection of Nodes is added to the current node.
no setterinherited
children → Map<String, Node>
These are the children of the node.
finalinherited
childrenAsList → List<ListenableNode>
This returns the children as an iterable list.
no setterinherited
data ↔ T?
The data value of T wrapped in the ITreeNode
getter/setter pairinherited
expansionNotifier → ValueNotifier<bool>
ValueNotifier for node expansion/collapse
latefinalinherited
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
insertedNodes → Stream<NodeInsertEvent<INode>>
The insertNodes stream is not allowed for the ListenableNode. The index based operations like 'insert' are not implemented in ListenableNode
no setterinherited
isExpanded → bool
Shows whether the node is expanded or not
no setterinherited
isLeaf → bool
Getter to check if the node is a Leaf. A Leaf-Node does have any children.
no setterinherited
isRoot → bool
Getter to check if the node is a root. Root is always the first node in a Tree. A Root-Node never has a parent.
no setterinherited
key → String
This is the uniqueKey of the Node
finalinherited
length → int
Getter to get the total number of children
no setterinherited
level → int
Getter to get the level i.e. how many iterations it will take to get to the root. ** Note: starting index is 0.
no setterinherited
listenableData → ValueNotifier<T?>
ValueNotifier for data T that can be listened for data changes;
final
meta ↔ Map<String, dynamic>?
Any related data that needs to be accessible from the node can be added to meta without needing to extend or implement the INode
getter/setter pairinherited
parent ↔ ListenableNode?
This is the parent ListenableNode. Only the root node has a null parent
covariantgetter/setter pairinherited
path → String
Path of the node in the tree. It provides information about the node hierarchy by listing all the ancestors of the node.
no setterinherited
removedNodes → Stream<NodeRemoveEvent<INode>>
Listen to this Stream to get updates on when a Node or a collection of Nodes is removed from the current node.
no setterinherited
root → ListenableNode
Getter to get the root node. If the current node is not a root, then the getter will traverse up the path to get the root.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
value → ListenableNode
Getter to get the value of the ValueListenable. It returns the root
no setterinherited

Methods

add(covariant Node value) → void
Add a value node to the children
inherited
addAll(covariant Iterable<Node> iterable) → void
Add a collection of Iterable nodes to this node
inherited
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
clear() → void
Clear all the child nodes from children. The children will be empty after this operation.
inherited
delete() → void
Delete this node
inherited
dispose() → void
Disposer to clear the listeners and StreamSubscriptions
inherited
elementAt(String path) → ListenableNode
  • Utility method to get a child node at the path. Get any item at path from the root The keys of the items to be traversed should be provided in the path
  • inherited
    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a nonexistent method or property is accessed.
    inherited
    notifyListeners() → void
    Call all the registered listeners.
    inherited
    remove(covariant Node value) → void
    Remove a child value node from the children
    inherited
    removeAll(covariant Iterable<Node> iterable) → void
    Remove all the Iterable nodes from the children
    inherited
    removeListener(VoidCallback listener) → void
    Remove a previously registered closure from the list of closures that are notified when the object changes.
    inherited
    removeWhere(bool test(Node element)) → void
    Remove all the child nodes from the children that match the criterion in the provided test
    inherited
    toString() → String
    A string representation of this object.
    inherited

    Operators

    operator ==(Object other) → bool
    The equality operator.
    inherited
    operator [](String path) → ListenableNode
    Overloaded operator for elementAt
    inherited