INode class abstract

Base class for Node that defines the required interfaces

Implementers

Constructors

INode()

Properties

children Object?
These are the children of the node. It is a collection that can be any appropriate data-structure like List or Map
no setter
childrenAsList List<INode>
This returns the children as an iterable list. Since children can be implemented using any suitable data-structure, therefore by having an iterable list as children ensures that the children can always be iterated when required.
no setter
hashCode int
The hash code for this object.
no setteroverride
isLeaf bool
Getter to check if the node is a Leaf. A Leaf-Node does have any children.
no setter
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 setter
key String
This is the uniqueKey that every node needs to implement
no setter
length int
Getter to get the total number of children
no setter
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 setter
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 pair
parent INode?
This is the parent INode. Only the root node has a null parent
covariantgetter/setter pair
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 setter
root INode
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 setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

elementAt(String path) INode
  • 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
  • noSuchMethod(Invocation invocation) → dynamic
    Invoked when a nonexistent method or property is accessed.
    inherited
    toString() String
    A string representation of this object.
    inherited

    Operators

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

    Constants

    PATH_SEPARATOR → const String
    ROOT_KEY → const String