create static method

Future<ShapePainterIcon> create(
  1. RenderinstructionIcon renderinstruction
)

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