Layer.fromJson constructor
Implementation
factory Layer.fromJson(Map<String, dynamic> json) {
return Layer(
layerId: LayerId.fromJson(json['layerId'] as String),
parentLayerId: json.containsKey('parentLayerId')
? LayerId.fromJson(json['parentLayerId'] as String)
: null,
backendNodeId: json.containsKey('backendNodeId')
? dom.BackendNodeId.fromJson(json['backendNodeId'] as int)
: null,
offsetX: json['offsetX'] as num,
offsetY: json['offsetY'] as num,
width: json['width'] as num,
height: json['height'] as num,
transform: json.containsKey('transform')
? (json['transform'] as List).map((e) => e as num).toList()
: null,
anchorX: json.containsKey('anchorX') ? json['anchorX'] as num : null,
anchorY: json.containsKey('anchorY') ? json['anchorY'] as num : null,
anchorZ: json.containsKey('anchorZ') ? json['anchorZ'] as num : null,
paintCount: json['paintCount'] as int,
drawsContent: json['drawsContent'] as bool? ?? false,
invisible:
json.containsKey('invisible') ? json['invisible'] as bool : null,
scrollRects: json.containsKey('scrollRects')
? (json['scrollRects'] as List)
.map((e) => ScrollRect.fromJson(e as Map<String, dynamic>))
.toList()
: null,
stickyPositionConstraint: json.containsKey('stickyPositionConstraint')
? StickyPositionConstraint.fromJson(
json['stickyPositionConstraint'] as Map<String, dynamic>)
: null,
);
}