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(), (dynamic a, b) => a.concat(b));
  var attributes = style;
  if (parent is BlockNode) {
    BlockNode block = parent as BlockNode;
    attributes = attributes.mergeAll(block.style);
  }
  delta.insert('\n', attributes.toJson());
  return delta;
}