UIComponent.fromJson constructor

UIComponent.fromJson(
  1. Map<String, dynamic> json
)

Implementation

UIComponent.fromJson(Map<String, dynamic> json) {
  // log("props3: ${json['props_3']}");
  // log(jsonEncode(json));

  type = json['type'];
  id = json['id'];
  properties = json['props'] != null
      ? [
          Properties.fromJson(json['props'], type!),
          Properties.fromJson({
            ...json['props'] ?? {},
            if (json['props_2'] != null) ...json['props_2']
          }, type!),
          Properties.fromJson({
            ...json['props'] ?? {},
            if (json['props_3'] != null) ...json['props_3']
          }, type!)
        ]
      : null;

  if (json['widgets'] != null) {
    widgets = <UIComponent>[];
    json['widgets'].forEach((v) {
      widgets!.add(UIComponent.fromJson(v));
    });
  }
}