IndexedTreeNode<T> class
A IndexedTreeNode that can be used with the IndexedTreeView
.
To use your own custom data with IndexedTreeView
, wrap your model T
in IndexedTreeNode
like this:
class YourCustomNode extends IndexedTreeView<CustomClass> {
...
}
- Inheritance
-
- Object
- INode
- IndexedNode
- IndexedListenableNode
- IndexedTreeNode
- Mixed-in types
-
- ITreeNode<
T>
- ITreeNode<
Constructors
- IndexedTreeNode({T? data, String? key, IndexedNode? parent})
-
A IndexedTreeNode constructor that can be used with the
IndexedTreeView
. Any data of typeT
can be wrapped withIndexedTreeView
- IndexedTreeNode.root({T? data})
-
Factory constructor to be used only for root IndexedTreeNode
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
→ List<
IndexedNode> -
These are the children of the node.
finalinherited
-
childrenAsList
→ List<
IndexedListenableNode> -
This returns the children as an iterable list.
no setterinherited
- data ↔ T?
-
The data value of
T
wrapped in the ITreeNodegetter/setter pairinherited -
expansionNotifier
→ ValueNotifier<
bool> -
ValueNotifier for node expansion/collapse
latefinalinherited
- first ↔ IndexedListenableNode
-
Get the first child in the list
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
insertedNodes
→ Stream<
NodeInsertEvent< INode> > -
Listen to this Stream to get updates on when a Node or a collection of
Nodes is inserted in the current node.
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
- last ↔ IndexedListenableNode
-
Set the last child in the list to value
getter/setter pairinherited
- 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 ↔ IndexedListenableNode?
-
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 → IndexedListenableNode
-
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 → IndexedListenableNode
-
Getter to get the value of the ValueListenable. It returns the root
no setterinherited
Methods
-
add(
covariant IndexedNode value) → void -
Add a child
value
node to the children. Thevalue
will be inserted after the last child in the listinherited -
addAll(
covariant Iterable< IndexedNode> iterable) → void -
Add a collection of Iterable nodes to children. The
iterable
will be inserted after the last child in the listinherited -
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
at(
int index) → IndexedListenableNode -
Returns the child node at the
index
inherited -
clear(
) → void -
Clear all the child nodes from children. The children will be empty
after this operation.
inherited
-
delete(
) → void -
Delete
this
nodeinherited -
dispose(
) → void -
inherited
-
elementAt(
String path) → IndexedListenableNode -
- Utility method to get a child node at the
path
. Get any item atpath
from the root The keys of the items to be traversed should be provided in thepath
inherited - Utility method to get a child node at the
-
firstWhere(
bool test(IndexedNode element), {IndexedNode orElse()?}) → IndexedListenableNode -
Get the first child node that matches the criterion in the
test
. An optionalorElse
function can be provided to handle thetest
is not able to find any node that matches the provided criterion.inherited -
indexWhere(
bool test(IndexedNode element), [int start = 0]) → int -
Get the index of the first child node that matches the criterion in the
test
. An optionalstart
index can be provided to ignore any nodes before the indexstart
inherited -
insert(
int index, IndexedNode element) → void -
Insert an
element
in the children list atindex
inherited -
insertAfter(
IndexedNode after, IndexedNode element) → int -
Insert an
element
in the children list after the nodeafter
inherited -
insertAll(
int index, Iterable< IndexedNode> iterable) → void -
Insert a collection of Iterable nodes in the children list at
index
inherited -
insertBefore(
IndexedNode before, IndexedNode element) → int -
Insert an
element
in the children list before the nodebefore
inherited -
lastWhere(
bool test(IndexedNode element), {IndexedNode orElse()?}) → IndexedListenableNode -
Get the last child node that matches the criterion in the
test
. An optionalorElse
function can be provided to handle thetest
is not able to find any node that matches the provided criterion.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 IndexedNode value) → void -
Remove a child
value
node from the childreninherited -
removeAll(
covariant Iterable< IndexedNode> iterable) → void -
Remove all the Iterable nodes from the children
inherited
-
removeAt(
int index) → IndexedListenableNode -
Remove the child node at the
index
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(IndexedNode element)) → void -
Remove all the child nodes from the children that match the criterion
in the given
test
inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String path) → IndexedListenableNode -
Overloaded operator for elementAt
inherited