create static method

Future<ShapePainterPolyline> create(
  1. RenderinstructionPolyline renderinstruction
)

Creates a new polyline 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<ShapePainterPolyline> create(RenderinstructionPolyline renderinstruction) async {
  return _taskQueue.add(() async {
    ShapePainterPolyline? shapePainter = PainterFactory().getPainterForSerial(renderinstruction.serial) as ShapePainterPolyline?;
    if (shapePainter != null) return shapePainter;
    shapePainter = ShapePainterPolyline._(renderinstruction);
    await shapePainter.init();
    PainterFactory().setPainterForSerial(renderinstruction.serial, shapePainter);
    return shapePainter;
  });
}