fromJson method
Implementation
PostBlock fromJson(Map<String, Object?> json) {
switch (json['type']) {
case 'paragraph':
return ParagraphBlock.fromJson(json);
case 'heading':
return HeadingBlock.fromJson(json);
case 'image':
return ImageBlock.fromJson(json);
case 'quote':
return QuoteBlock.fromJson(json);
case 'list':
return ListBlock.fromJson(json);
case 'embed':
return EmbedBlock.fromJson(json);
case 'divider':
return DividerBlock.fromJson(json);
default:
return ParagraphBlock((json['text'] as String?) ?? '');
}
}