textPainter property

TextPainter? get textPainter

Get the TextPainter for the polygon label (cached).

Returns null if Polygon.label is not set.

Implementation

TextPainter? get textPainter {
  if (label != null) {
    return _textPainter ??= TextPainter(
      text: TextSpan(text: label, style: labelStyle),
      textAlign: TextAlign.center,
      textDirection: TextDirection.ltr,
    )..layout();
  }
  return null;
}