copyFrom function

FNode copyFrom(
  1. FNode node
)

Implementation

FNode copyFrom(FNode node) {
  return switch (node) {
    Link() => Link(url: node.url),
    Fragment() => Fragment(node.text),
    Paragraph() => Paragraph()..fragments = node.fragments.map(copyFrom).toList(),
    _ => throw Exception('Node type not supported: ${node.runtimeType}'),
  };
}