Node<T> class

Inheritance
Mixed in types
Annotations
  • @KeyOrNullConverter()
  • @ColorOrNullConverter()
  • @IconDataOrNullConverter()
  • @JsonSerializable()
  • @GenericConverter()

Constructors

Node({required Key key, required String label, IconData? icon, Color? iconColor, Color? selectedIconColor, bool expanded = false, List<Node<T>>? children, T? data})
Node.fromJson(Map<String, dynamic> json)
A necessary factory constructor for creating a new Node instance from a map. Pass the map to the generated _$NodeFromJson() constructor. The constructor is named after the source class, in this case, Node.
factory
Node.fromLabel(String label, {Key? key, T? data, IconData? icon, List<Node<T>>? children})
Creates a Node from a string value. By default, if key is not provided, it will generates a unique key.
factory

Properties

ancestors Iterable<Node<T>>
Returns the path from the root Node to this node, not including this.
no setter
children List<Node<T>>
no setter
data ↔ T?
Generic data model that can be assigned to the TreeNode. This makes it useful to assign and retrieve data associated with the TreeNode
getter/setter pair
depth int
The nested depth of the Node.
no setter
descendants Iterable<Node<T>>
Returns an Iterable of every Node under this.
no setter
expanded bool
no setter
firstChild Node<T>?
Returns the first child of this Node or null if children is empty.
no setter
hasChildren bool
Whether this Node has children.
no setter
hasData bool
Whether this Node has data associated with it.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasIcon bool
Whether this Node has a non-null icon.
no setter
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
hasNextSibling bool
Whether or not this Node is the last child of its parent.
no setter
hasParent bool
Whether this Node has parent.
no setter
icon IconData?
no setter
iconColor Color?
no setter
isRoot bool
Whether or not this Node is the root.
no setter
key Key
The unique string that identifies this object.
final
label String
no setter
lastChild Node<T>?
Returns the last child of this Node or null if children is empty.
no setter
parent Node<T>?
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selected bool
no setter
selectedIconColor Color?
no setter

Methods

addChild(Node<T> child, [InsertMode mode = InsertMode.append]) → void
Adds a single child to this node and sets its parent property to this.
addChildren(Iterable<Node<T>> children) → void
Adds a list of children to this node.
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
compareTo(Node<T> other) int
Set this Node to sortable
override
copyWith({Key? key, String? label, IconData? icon, Color? iconColor, Color? selectedIconColor, bool? expanded, List<Node<T>>? children, T? data}) Node<T>
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
findChild(Key key) Node<T>?
Search the node that has a key value equal to the specified key.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeChild(Key key, {bool recursive = false}) → void
Removes a single child from this node and set its parent to null.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toggleExpand([bool? value]) → void
toggleSelect([bool? value]) → void
toJson() Map<String, dynamic>
toJson is the convention for a class to declare support for serialization to JSON. The implementation simply calls the private, generated helper method _$NodeToJson.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited