copyWith method

  1. @override
TextNodeV0 copyWith({
  1. String? type = 'text',
  2. LinkedList<NodeV0>? children,
  3. Attributes? attributes,
  4. Delta? delta,
})
override

Implementation

@override
TextNodeV0 copyWith({
  String? type = 'text',
  LinkedList<NodeV0>? children,
  Attributes? attributes,
  Delta? delta,
}) {
  final textNode = TextNodeV0(
    children: children,
    attributes: attributes ?? this.attributes,
    delta: delta ?? this.delta,
  );
  if (children == null && this.children.isNotEmpty) {
    for (final child in this.children) {
      textNode.children.add(
        child.copyWith()..parent = textNode,
      );
    }
  }
  return textNode;
}