IndexedNode class
- Inheritance
- Implemented types
- Implementers
Constructors
- IndexedNode({String? key, IndexedNode? parent})
- The more comprehensive variant of Node that uses List to store the children.
- IndexedNode.root()
-
Alternate factory constructor that should be used for the root nodes.
factory
Properties
-
children
→ List<
IndexedNode> -
These are the children of the node.
final
-
childrenAsList
→ List<
IndexedNode> -
This returns the children as an iterable list.
no setteroverride
- first ↔ IndexedNode
-
Get the first child in the list
getter/setter pairoverride
- hashCode → int
-
The hash code for this object.
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
final
- last ↔ IndexedNode
-
Get the last child in the list
getter/setter pairoverride
- 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.
no setterinherited
-
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 pairoverride
- parent ↔ IndexedNode?
-
This is the parent Node. Only the root node has a null parent
covariantgetter/setter pairoverride
- 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
- root → IndexedNode
-
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 setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
covariant IndexedNode value) → void -
Add a child
valuenode to the children. Thevaluewill be inserted after the last child in the listoverride -
addAll(
covariant Iterable< IndexedNode> iterable) → void -
Add a collection of Iterable nodes to children. The
iterablewill be inserted after the last child in the listoverride -
at(
int index) → IndexedNode -
Returns the child node at the
indexoverride -
clear(
) → void -
Clear all the child nodes from children. The children will be empty
after this operation.
override
-
delete(
) → void -
Delete
thisnodeoverride -
elementAt(
String path) → IndexedNode -
- Utility method to get a child node at the
path. Get any item atpathfrom the root The keys of the items to be traversed should be provided in thepathoverride - Utility method to get a child node at the
-
firstWhere(
bool test(IndexedNode element), {IndexedNode orElse()?}) → IndexedNode -
Get the first child node that matches the criterion in the
test. An optionalorElsefunction can be provided to handle thetestis not able to find any node that matches the provided criterion.override -
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 optionalstartindex can be provided to ignore any nodes before the indexstartoverride -
insert(
int index, IndexedNode element) → void -
Insert an
elementin the children list atindexoverride -
insertAfter(
IndexedNode after, IndexedNode element) → int -
Insert an
elementin the children list after the nodeafteroverride -
insertAll(
int index, Iterable< IndexedNode> iterable) → void -
Insert a collection of Iterable nodes in the children list at
indexoverride -
insertBefore(
IndexedNode before, IndexedNode element) → int -
Insert an
elementin the children list before the nodebeforeoverride -
lastWhere(
bool test(IndexedNode element), {IndexedNode orElse()?}) → IndexedNode -
Get the last child node that matches the criterion in the
test. An optionalorElsefunction can be provided to handle thetestis not able to find any node that matches the provided criterion.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
covariant IndexedNode value) → void -
Remove a child
valuenode from the childrenoverride -
removeAll(
covariant Iterable< IndexedNode> iterable) → void -
Remove all the Iterable nodes from the children
override
-
removeAt(
int index) → IndexedNode -
Remove the child node at the
indexoverride -
removeWhere(
bool test(IndexedNode element)) → void -
Remove all the child nodes from the children that match the criterion
in the given
testoverride -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String path) → IndexedNode -
Overloaded operator for elementAt
override