Node<T> class Null safety

Defines the data used to display a TreeNode.

Used by TreeView to display a TreeNode.

This object allows the creation of key, label and icon to display a node on the TreeView widget. The key and label properties are required. The key is needed for events that occur on the generated TreeNode. It should always be unique.

Constructors

Node({required String key, required String label, List<Node> children = const [], bool expanded = false, bool parent = false, IconData? icon, Color? iconColor, Color? selectedIconColor, T? data})
const

Properties

asMap Map<String, dynamic>
Map representation of this object
read-only
children List<Node>
The sub Nodes of this object.
final
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
final
expanded bool
The open or closed state of the TreeNode. Applicable only if the node is a parent
final
hasData bool
Whether this object has data associated with it.
read-only
hashCode int
The hash code for this object.
read-onlyoverride
hasIcon bool
Whether this object has a non-null icon.
read-only
icon IconData?
An optional icon that is displayed on the TreeNode.
final
iconColor Color?
An optional color that will be applied to the icon for this node.
final
isParent bool
Whether this object has children Node.
read-only
key String
The unique string that identifies this object.
final
label String
The string value that is displayed on the TreeNode.
final
parent bool
Force the node to be a parent so that node can show expander without having children node.
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
selectedIconColor Color?
An optional color that will be applied to the icon when this node is selected.
final

Methods

copyWith({String? key, String? label, List<Node>? children, bool? expanded, bool? parent, IconData? icon, Color? iconColor, Color? selectedIconColor, T? data}) Node<T>
Creates a copy of this object but with the given fields replaced with the new values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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

Static Methods

fromLabel<T>(String label) Node<T>
Creates a Node from a string value. It generates a unique key.
fromMap<T>(Map<String, dynamic> map) Node<T>
Creates a Node from a Map<String, dynamic> map. The map should contain a "label" value. If the key value is missing, it generates a unique key. If the expanded value, if present, can be any 'truthful' value. Excepted values include: 1, yes, true and their associated string values.