RichTextLeafMark.fromJson constructor

RichTextLeafMark.fromJson(
  1. JSONMap json
)

Implementation

factory RichTextLeafMark.fromJson(JSONMap json) {
  final type = json["type"];
  return switch (type) {
    "bold" => RichTextLeafMarkBold(),
    "italic" => RichTextLeafMarkItalic(),
    "strike" => RichTextLeafMarkStrike(),
    "underline" => RichTextLeafMarkUnderline(),
    "superscript" => RichTextLeafMarkSuperscript(),
    "subscript" => RichTextLeafMarkSubscript(),
    "code" => RichTextLeafMarkCode(),
    "anchor" => RichTextLeafMarkAnchor.fromJson(json),
    "link" => RichTextLeafMarkLink.fromJson(json),
    "textStyle" => RichTextLeafMarkTextStyle.fromJson(json),
    "highlight" => RichTextLeafMarkHighlight.fromJson(json),
    _ => UnrecognizedRichTextLeafMark(type, json),
  };
}