fromJson static method
fromJson method
Implementation
static fromJson(String widgetType, Map<String, dynamic> json) {
if (widgetType != NType.listView) {
throw Exception('Invalid widget type');
}
final attributes = <String, dynamic>{};
if (json['properties'] != null) {
for (final entry in (json['properties'] as Map<String, dynamic>)
.entries
.where((e) => e.value != null)) {
attributes[entry.key] =
const DynamicAttributes().fromJson(entry.key, entry.value);
}
}
final rectProperties = RectProperties.fromJson(json['rect_properties']);
return ListViewOpenNode(
id: json['id'],
name: json['name'],
description: json['description'],
parentID: json['parent_id'],
attributes: attributes,
rectProperties: rectProperties,
updatedAt: DateTime.parse(json['updated_at']),
childOrder: json['child_order'] != null
? (json['child_order'] as num).toDouble()
: null,
pageID: json['page_id'],
stabilID: json['stabil_id'],
componentID: json['component_id'],
isLocked: json['is_locked'],
);
}