PaintingLayerData.fromMap constructor
Factory constructor for creating a PaintingLayerData instance from a Layer and a map.
Implementation
factory PaintingLayerData.fromMap(Layer layer, Map<String, dynamic> map) {
/// Constructs and returns a PaintingLayerData instance with properties
/// derived from the layer and map.
return PaintingLayerData(
flipX: layer.flipX,
flipY: layer.flipY,
enableInteraction: layer.enableInteraction,
offset: layer.offset,
rotation: layer.rotation,
scale: layer.scale,
opacity: safeParseDouble(map['opacity'], fallback: 1.0),
rawSize: Size(
safeParseDouble(map['rawSize']?['w'], fallback: 0),
safeParseDouble(map['rawSize']?['h'], fallback: 0),
),
item: PaintedModel.fromMap(map['item'] ?? {}),
);
}