create static method

Future<ShapePainterCircle> create(
  1. RenderinstructionCircle renderinstruction
)

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