LeafNode constructor

LeafNode([
  1. String value = ''
])

Implementation

factory LeafNode([String value = '']) {
  LeafNode node;
  if (value == kZeroWidthSpace) {
    // Zero-width space is reserved for embed nodes.
    node = EmbedNode();
  } else {
    assert(
        !value.contains(kZeroWidthSpace),
        'Zero-width space is reserved for embed leaf nodes and cannot be used '
        'inside regular text nodes.');
    node = TextNode(value);
  }
  return node;
}