Leaf constructor

Leaf(
  1. Object data
)

Creates a new Leaf with specified data.

Implementation

factory Leaf(Object data) {
  if (data is Embeddable) {
    return Embed(data);
  }
  final text = data as String;
  assert(text.isNotEmpty);
  return NodeText(text);
}