parseCommonLayerJson function
Parses the fields Layer.commonJson adds, shared by every concrete
layer's fromJson.
Implementation
CommonLayerFields parseCommonLayerJson(Map<String, Object?> json) {
final sizeJson = json['size'] as Map<String, Object?>?;
return (
id: json['id'] as String,
transform: LayerTransform.fromJson(
json['transform'] as Map<String, Object?>,
),
size: sizeJson == null ? null : Size2D.fromJson(sizeJson),
opacity: (json['opacity'] as num).toDouble(),
zIndex: json['zIndex'] as int,
visible: json['visible'] as bool,
clipToBounds: json['clipToBounds'] as bool? ?? false,
);
}