isEmpty property

bool isEmpty

Returns whether the root Node does not contain any text.

Implementation

bool get isEmpty {
  if (root.children.isEmpty) {
    return true;
  }

  if (root.children.length > 1) {
    return false;
  }

  final node = root.children.first;
  final delta = node.delta;
  if (delta != null && (delta.isEmpty || delta.toPlainText().isEmpty)) {
    return true;
  }

  return false;
}