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