CustomerPlaceContent.fromJson constructor

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

Implementation

factory CustomerPlaceContent.fromJson(Map<String, dynamic> json) {
  TemplateKeys templateKey =
      stringToEnum(json['template_key'], TemplateKeys.values, TemplateKeys.carousel_images_template);
  return CustomerPlaceContent(
    uuid: json['uuid'],
    keyboardCode: json['keyboard_code'] ?? '',
    templateKey: templateKey,
    template: jsonToTemplateClass(templateKey, json[enumToString(templateKey)]),
    categories: List<CustomerPlaceCategory>.from(json['categories'].map((x) => CustomerPlaceCategory.fromJson(x))),
    locators: List<String>.from(json['locators'].map((x) => x.toString())),
  );
}