IndexedListenableNode class
- Inheritance
-
- Object
- INode
- IndexedNode
- IndexedListenableNode
- Implemented types
- Mixed-in types
- Implementers
Constructors
- IndexedListenableNode({String? key, IndexedNode? parent})
- A listenable implementation the Node. The mutations to the Node can be listened to using the ValueListenable interface or the addedNodes and removedNodes streams.
- IndexedListenableNode.root()
-
Alternate factory constructor for IndexedListenableNode that should be used for
the root nodes.
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 setteroverride
-
children
→ List<
IndexedNode> -
These are the children of the node.
finalinherited
-
childrenAsList
→ List<
IndexedListenableNode> -
This returns the children as an iterable list.
no setteroverride
- first ↔ IndexedListenableNode
-
Get the first child in the list
getter/setter pairoverride
- 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 setteroverride
- 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 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.
** 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 pairinherited
- parent ↔ IndexedListenableNode?
-
This is the parent ListenableNode. 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
-
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 setteroverride
- 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 setteroverride
- 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 setteroverride
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 -
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
indexoverride -
clear(
) → void -
Clear all the child nodes from children. The children will be empty
after this operation.
override
-
delete(
) → void -
Delete
thisnodeoverride -
dispose(
) → void -
override
-
elementAt(
String path) → IndexedListenableNode -
- 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()?}) → IndexedListenableNode -
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()?}) → IndexedListenableNode -
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
-
notifyListeners(
) → void -
Call all the registered listeners.
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) → IndexedListenableNode -
Remove the child node at the
indexoverride -
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
testoverride -
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
override