create static method

Future<ShapePainterPolylineText> create(
  1. RenderinstructionPolylineText renderinstruction
)

Creates a new polyline text shape painter with asynchronous initialization.

Uses a task queue to ensure thread-safe creation and caches the result in the rendering instruction to avoid duplicate creation.

Implementation

static Future<ShapePainterPolylineText> create(RenderinstructionPolylineText renderinstruction) async {
  return _taskQueue.add(() async {
    ShapePainterPolylineText? shapePainter = PainterFactory().getPainterForSerial(renderinstruction.serial) as ShapePainterPolylineText?;
    if (shapePainter != null) return shapePainter;
    shapePainter = ShapePainterPolylineText._(renderinstruction);
    PainterFactory().setPainterForSerial(renderinstruction.serial, shapePainter);
    return shapePainter;
  });
}