toPostBlock method
Converte para o bloco imutável correspondente da lib.
Implementation
PostBlock toPostBlock() {
switch (type) {
case BlockType.paragraph:
return ParagraphBlock(text);
case BlockType.heading:
return HeadingBlock(text, level: level);
case BlockType.image:
return ImageBlock(
url,
caption: text.isEmpty ? null : text,
credit: secondary.isEmpty ? null : secondary,
);
case BlockType.quote:
return QuoteBlock(text, cite: secondary.isEmpty ? null : secondary);
case BlockType.list:
return ListBlock(_items, ordered: ordered);
case BlockType.embed:
return EmbedBlock(text);
case BlockType.divider:
return const DividerBlock();
}
}