fromJson static method
dynamic
fromJson(
- String widgetType,
- Map<
String, dynamic> json, - DynamicAttributes parser,
- ActionMapper actionMapper,
override
fromJson method
Implementation
static fromJson(String widgetType, Map<String, dynamic> json,
DynamicAttributes parser, ActionMapper actionMapper) {
if (widgetType != NType.icon) {
throw Exception('Invalid widget type');
}
final attributes = <String, dynamic>{};
final properties = json['properties'] as Map<String, dynamic>?;
properties?.forEach((key, value) {
if (key != 'key' && value != null) {
attributes[key] = parser.fromJson(key, value, actionMapper);
}
});
final rectProperties = RectProperties.fromJson(json['rect_properties']);
return IconOpenNode(
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'],
);
}