create static method

Future<ShapePainterSymbol> create(
  1. RenderinstructionSymbol renderinstruction
)

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