fromJson method

  1. @override
FNode fromJson(
  1. Map<String, dynamic> json
)

Implementation

@override
FNode fromJson(Map<String, dynamic> json) {
  final type = json['type'] as String?;
  switch (type) {
    case 'paragraph':
      return Paragraph.fromJson(json);
    case 'link':
      return Link.fromJson(json);
    case 'list':
      return FluentList.fromJson(json);
    case 'listItem':
      return ListItem.fromJson(json);
    case 'row':
      return FluentRow.fromJson(json);
    case 'cell':
      return FluentCell.fromJson(json);
    case 'table':
      return FluentTable.fromJson(json);
    case 'image':
      return FluentImage.fromJson(json);
    case 'hr':
      return HorizontalRule.fromJson(json);
    case 'fragment':
      return Fragment.fromJson(json);
    default:
      throw Exception('Unknown node type: $type');
  }
}