toDelta method

  1. @override
Delta toDelta()
override

Returns Delta representation of this node.

Implementation

@override
Delta toDelta() {
  final delta = children
      .map((child) => child.toDelta())
      .fold(Delta(), (Delta a, b) => a.concat(b));
  var attributes = style;
  if (parent is BlockNode) {
    var block = parent as BlockNode;
    attributes = attributes.mergeAll(block.style);
  }
  delta.insert('\n', attributes.toJson());
  return delta;
}