Node<T> class
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.new({required String key, required String label, List<
Node< children = const [], bool expanded = false, bool parent = false, IconData? icon, T? data})T> > -
const
- Node.fromLabel(String label)
-
Creates a Node from a string value. It generates a unique key.
factory
-
Node.fromMap(Map<
String, dynamic> map) -
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.
factory
Properties
-
asMap
→ Map<
String, dynamic> -
Map representation of this object
no setter
-
children
→ List<
Node< T> > -
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.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- hasIcon → bool
-
Whether this object has a non-null icon.
no setter
- icon → IconData?
-
An optional icon that is displayed on the TreeNode.
final
- isParent → bool
-
Whether this object has children Node.
no setter
- 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.
no setterinherited
Methods
-
copyWith(
{String? key, String? label, List< Node< ? children, bool? expanded, bool? parent, IconData? icon, T? data}) → Node<T> >T> - Creates a copy of this object but with the given fields replaced with the new values.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override