SchematicInstanceData.fromJson constructor
Create a new SchematicInstanceData from JSON data.
Implementation
factory SchematicInstanceData.fromJson(Map<String, dynamic> json) {
final childList = <String>[];
if (json['children'] is List) {
for (final c in json['children'] as List) {
if (c != null) {
childList.add(c.toString());
}
}
}
return SchematicInstanceData(
id: json['id']?.toString() ?? '',
x: (json['x'] as num?)?.toDouble() ?? 0.0,
y: (json['y'] as num?)?.toDouble() ?? 0.0,
width: (json['width'] as num?)?.toDouble() ?? 50.0,
height: (json['height'] as num?)?.toDouble() ?? 30.0,
name: json['name']?.toString() ?? '',
cls: json['cls']?.toString() ?? '',
bodyText: json['bodyText']?.toString() ?? '',
isExternalPort: json['isExternalPort'] == true,
cssClass: json['cssClass']?.toString() ?? '',
children: childList,
portLabelWidth: (json['portLabelWidth'] as num?)?.toDouble(),
hasChildren: json['hasChildren'] == true,
isExpanded: json['isExpanded'] == true,
isPartiallyExpanded: json['isPartiallyExpanded'] == true,
hasHiddenNonPrimitiveChildren:
json['hasHiddenNonPrimitiveChildren'] == true,
hasNonPrimitiveChildren: json['hasNonPrimitiveChildren'] == true,
hierarchyPath: json['hierarchyPath']?.toString(),
definitionName: json['definitionName']?.toString(),
);
}