toDelta method

  1. @override
Delta toDelta()
override

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 Block) {
    final block = parent as Block;
    attributes = attributes.mergeAll(block.style);
  }
  delta.insert('\n', attributes.toJson());
  return delta;
}