text property

TextSpan? text

The (potentially styled) text to paint.

After this is set, you must call layout before the next call to paint. This must be non-null before you call layout.

The TextSpan this provides is in the form of a tree that may contain multiple instances of TextSpans. To obtain a plain text representation of the contents of this MongolTextPainter, use plainText.

Implementation

TextSpan? get text => _text;
void text=(TextSpan? value)

Implementation

set text(TextSpan? value) {
  assert(value == null || value.debugAssertIsValid());
  if (_text == value) {
    return;
  }
  if (_text?.style != value?.style) {
    _layoutTemplate?.dispose();
    _layoutTemplate = null;
  }

  final RenderComparison comparison = value == null
      ? RenderComparison.layout
      : _text?.compareTo(value) ?? RenderComparison.layout;

  _text = value;
  _cachedPlainText = null;

  if (comparison.index >= RenderComparison.layout.index) {
    markNeedsLayout();
  } else if (comparison.index >= RenderComparison.paint.index) {
    // Don't clear the _paragraph instance variable just yet. It still
    // contains valid layout information.
    _rebuildParagraphForPaint = true;
  }
  // Neither relayout or repaint is needed.
}