toHtml method

  1. @override
String toHtml()
override

Converts the rich text and all its spans into an HTML representation.

Each FlintTextSpan is rendered as a <span> or <a> tag depending on whether it has a link (onTap property). The alignment is applied via inline CSS.

Implementation

@override
String toHtml() {
  final style =
      'text-align: ${align.toCss()}; line-height: 1.6; display: block;';
  return '''
<div style="$style">
${children.map((span) => span.toHtml()).join()}
</div>
''';
}