toHtml method

String toHtml()

Converts the span to HTML. If onTap is set, wraps text in an <a> tag.

Example:

<a href="https://example.com" style="color: #007BFF;">Click here</a>

Implementation

String toHtml() {
  final styleAttr = _buildStyle();
  if (onTap != null) {
    return '<a href="$onTap" style="$styleAttr">${_escapeHtml(text)}</a>';
  }
  return '<span style="$styleAttr">${_escapeHtml(text)}</span>';
}