build method

void build (ParagraphBuilder builder, { double textScaleFactor: 1.0 })

Apply the style, text, and children of this object to the given ParagraphBuilder, from which a Paragraph can be obtained. Paragraph objects can be drawn on Canvas objects.

Rather than using this directly, it's simpler to use the TextPainter class to paint TextSpan objects onto Canvas objects.

Implementation

void build(ui.ParagraphBuilder builder, { double textScaleFactor = 1.0 }) {
  assert(debugAssertIsValid());
  final bool hasStyle = style != null;
  if (hasStyle)
    builder.pushStyle(style.getTextStyle(textScaleFactor: textScaleFactor));
  if (text != null)
    builder.addText(text);
  if (children != null) {
    for (TextSpan child in children) {
      assert(child != null);
      child.build(builder, textScaleFactor: textScaleFactor);
    }
  }
  if (hasStyle)
    builder.pop();
}