Node class

Inheritance
Implemented types
Implementers

Constructors

Node({String? key, Node? parent})
The simple Node that use a Map to store the children.
Node.root()
Alternate factory constructor that should be used for the root nodes.
factory

Properties

children Map<String, Node>
These are the children of the node.
final
childrenAsList List<Node>
This returns the children as an iterable list.
no setteroverride
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
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
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 Node?
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 Node
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 Node value) → void
Add a value node to the children
override
addAll(covariant Iterable<Node> iterable) → void
Add a collection of Iterable nodes to children
override
clear() → void
Clear all the child nodes from children. The children will be empty after this operation.
override
delete() → void
Delete this node
override
elementAt(String path) Node
  • 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
  • override
    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a nonexistent method or property is accessed.
    inherited
    remove(covariant Node value) → void
    Remove a child value node from the children
    override
    removeAll(covariant Iterable<Node> iterable) → void
    Remove all the Iterable nodes from the children
    override
    removeWhere(bool test(Node element)) → void
    Remove all the child nodes from the children that match the criterion in the provided test
    override
    toString() String
    A string representation of this object.
    override

    Operators

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