copyWith method

NodeV0 copyWith({
  1. String? type,
  2. LinkedList<NodeV0>? children,
  3. Attributes? attributes,
})

Implementation

NodeV0 copyWith({
  String? type,
  LinkedList<NodeV0>? children,
  Attributes? attributes,
}) {
  final node = NodeV0(
    type: type ?? this.type,
    attributes: attributes ?? {...this.attributes},
    children: children,
  );
  if (children == null && this.children.isNotEmpty) {
    for (final child in this.children) {
      node.children.add(
        child.copyWith()..parent = node,
      );
    }
  }
  return node;
}