Paragraph.fromEmbed constructor

Paragraph.fromEmbed(
  1. Operation operation, {
  2. String? id,
})

Constructs a Paragraph instance from a Quill Delta embed operation.

This factory method creates a paragraph with a single line from the provided embed operation.

operation is the Quill Delta operation representing the embed.

Implementation

factory Paragraph.fromEmbed(fq.Operation operation, {String? id}) {
  return Paragraph(
    id: id,
    lines: <Line>[
      Line.fromData(data: operation.data!, attributes: operation.attributes),
    ],
    type:
        operation.data is String ? ParagraphType.inline : ParagraphType.embed,
  )..seal();
}