validate method

void validate()

Validates the state of the GText object, checking if the builder needs to be updated, and if the size needs to be calculated. This method should be called before the object is rendered to ensure that the text is up-to-date and has the correct dimensions.

If the builder is invalid, this method will rebuild it by creating a new ui.ParagraphBuilder with the current _paragraphStyle and _style and adding the current _text to it. The resulting ui.Paragraph will then be stored in the _paragraph property.

If the size is invalid or the builder is invalid, this method will calculate the size of the text and store it. properties. This is done by calling the ui.Paragraph.layout.

Implementation

void validate() {
  if (_invalidBuilder) {
    _invalidateBuilder();
    _invalidBuilder = false;
  }
  if (_invalidSize || _invalidBuilder) {
    _layout();
    _invalidSize = false;
    _invalidBuilder = false;
  }
}