Paragraph.fromEmbed constructor

Paragraph.fromEmbed(
  1. Operation operation
)

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) {
  return Paragraph(
    lines: <Line>[
      Line.fromData(data: operation.data!, attributes: operation.attributes),
    ],
    type:
        operation.data is String ? ParagraphType.inline : ParagraphType.embed,
  )..seal();
}