stringToBlockType function

BlockTypes stringToBlockType(
  1. String type
)

Returns the block type of the given block type string.

Implementation

BlockTypes stringToBlockType(String type) {
  switch (type) {
    case 'heading_1':
      return BlockTypes.H1;
    case 'heading_2':
      return BlockTypes.H2;
    case 'heading_3':
      return BlockTypes.H3;
    case 'paragraph':
      return BlockTypes.Paragraph;
    case 'bulleted_list_item':
      return BlockTypes.BulletedListItem;
    case 'numbered_list_item':
      return BlockTypes.NumberedListItem;
    case 'toogle':
      return BlockTypes.Toggle;
    case 'to_do':
      return BlockTypes.ToDo;
    case 'child_page':
      return BlockTypes.Child;
    case 'unsupported':
      return BlockTypes.Unsupported;
    case '':
    default:
      return BlockTypes.None;
  }
}