KdlNode class

A KDL node. Nodes can have positional arguments, key=value properties, and other nodes as children.

Mixed-in types

Constructors

KdlNode(String name, {List<KdlNode>? children, List<KdlValue>? arguments, Map<String, KdlValue>? properties, String? type})
Construct a new KDL node

Properties

arguments List<KdlValue>
Positional arguments
getter/setter pair
children List<KdlNode>
Child nodes
getter/setter pair
first KdlNode
The first element.
no setterinherited
hasChildren bool
Returns true if this node has at least one child node
no setter
hashCode int
The hash code for this object.
no setteroverride
isEmpty bool
Whether this collection has no elements.
no setterinherited
isNotEmpty bool
Whether this collection has at least one element.
no setterinherited
iterator Iterator<KdlNode>
A new Iterator that allows iterating the elements of this Iterable.
no setteroverride
last KdlNode
The last element.
no setterinherited
length int
The number of elements in this Iterable.
no setterinherited
name String
The name of the node
getter/setter pair
properties Map<String, KdlValue>
Key=value properties
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single KdlNode
Checks that this iterable has only one element, and returns that element.
no setterinherited
type String?
Optional type annotation
getter/setter pair

Methods

any(bool test(KdlNode element)) bool
Checks whether any element of this iterable satisfies test.
inherited
arg(dynamic key) → dynamic
Return the value of the first arg of the requested child node
args(dynamic key) → dynamic
Return the argument values of the requested child node
asType(String type, [KdlTypeParser<KdlNode>? parser]) KdlNode
Sets the type of a node. If a parser is provided, calls the function with the node and type and returns the result if any, otherwise returns this
cast<R>() Iterable<R>
A view of this iterable as an iterable of R instances.
inherited
child(dynamic key) KdlNode
Request a child node by key. If key is an int, return the node by index. If the key is a String, return the first node with that name
contains(Object? element) bool
Whether the collection contains an element equal to element.
inherited
dashVals(dynamic key) → dynamic
Return the first argument value of each node named '-' that is a child of the requested child node
elementAt(int index) KdlNode
Returns the indexth element.
inherited
every(bool test(KdlNode element)) bool
Checks whether every element of this iterable satisfies test.
inherited
expand<T>(Iterable<T> toElements(KdlNode element)) Iterable<T>
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere(bool test(KdlNode element), {KdlNode orElse()?}) KdlNode
The first element that satisfies the given predicate test.
inherited
fold<T>(T initialValue, T combine(T previousValue, KdlNode element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value
inherited
followedBy(Iterable<KdlNode> other) Iterable<KdlNode>
Creates the lazy concatenation of this iterable and other.
inherited
forEach(void action(KdlNode element)) → void
Invokes action on each element of this iterable in iteration order.
inherited
join([String separator = ""]) String
Converts each element to a String and concatenates the strings.
inherited
lastWhere(bool test(KdlNode element), {KdlNode orElse()?}) KdlNode
The last element that satisfies the given predicate test.
inherited
map<T>(T toElement(KdlNode e)) Iterable<T>
The current elements of this iterable modified by toElement.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reduce(KdlNode combine(KdlNode value, KdlNode element)) KdlNode
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
inherited
singleWhere(bool test(KdlNode element), {KdlNode orElse()?}) KdlNode
The single element that satisfies test.
inherited
skip(int count) Iterable<KdlNode>
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(KdlNode element)) Iterable<KdlNode>
Creates an Iterable that skips leading elements while test is satisfied.
inherited
take(int count) Iterable<KdlNode>
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(KdlNode element)) Iterable<KdlNode>
Creates a lazy iterable of the leading elements satisfying test.
inherited
toList({bool growable = true}) List<KdlNode>
Creates a List containing the elements of this Iterable.
inherited
toSet() Set<KdlNode>
Creates a Set containing the same elements as this iterable.
inherited
toString() String
A string representation of this object.
override
where(bool test(KdlNode element)) Iterable<KdlNode>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
inherited
whereType<T>() Iterable<R>
Creates a new lazy Iterable with all elements that have type T.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override
operator [](dynamic key) → dynamic
If key is an int, return the value of the appropriate positional argument. If key is a String, return the value of the matching property