RenderObjectData.fromJson constructor
Deserializes a RenderObjectData and its children from the given json
.
Implementation
factory RenderObjectData.fromJson(Map<String, Object?> json) {
final paintBounds = (json['pb'] as List<Object?>).cast<double>();
final data = RenderObjectData(
paintBounds: Rect.fromLTRB(
paintBounds[0],
paintBounds[1],
paintBounds[2],
paintBounds[3],
),
type: json['t'] as String,
);
final children =
(json['c'] as List<Object?>?)?.cast<Map<String, Object?>>() ?? [];
for (var json in children) {
data.addChild(RenderObjectData.fromJson(json));
}
return data;
}