create static method

Future<ShapePainterArea> create(
  1. RenderinstructionArea renderinstruction
)

Creates a new area 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.

renderinstruction Area rendering instruction to create painter for Returns initialized area shape painter

Implementation

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