Untitled

 avatar
unknown
plain_text
2 years ago
12 kB
3
Indexable
// To parse this JSON data, do
//
//     final categoryProductListModel = categoryProductListModelFromJson(jsonString);

import 'dart:convert';

CategoryProductListModel categoryProductListModelFromJson(String str) =>
    CategoryProductListModel.fromJson(json.decode(str));

String categoryProductListModelToJson(CategoryProductListModel data) =>
    json.encode(data.toJson());

class CategoryProductListModel {
  List<ProductList>? productList;
  List<Variation>? variations;

  CategoryProductListModel({
    this.productList,
    this.variations,
  });

  factory CategoryProductListModel.fromJson(Map<String, dynamic> json) =>
      CategoryProductListModel(
        productList: json["Product_LIST"] == null
            ? []
            : List<ProductList>.from(
                json["Product_LIST"]!.map((x) => ProductList.fromJson(x))),
        variations: json["Variations"] == null
            ? []
            : List<Variation>.from(
                json["Variations"]!.map((x) => Variation.fromJson(x))),
      );

  Map<String, dynamic> toJson() => {
        "Product_LIST": productList == null
            ? []
            : List<dynamic>.from(productList!.map((x) => x.toJson())),
        "Variations": variations == null
            ? []
            : List<dynamic>.from(variations!.map((x) => x.toJson())),
      };
}

class ProductList {
  String? the0;
  String? the1;
  dynamic the2;
  String? the3;
  The4? the4;
  dynamic the5;
  dynamic the6;
  dynamic the7;
  dynamic the8;
  dynamic the9;
  dynamic the10;
  String? the11;
  String? the12;
  dynamic the13;
  String? the14;
  dynamic the15;
  dynamic the16;
  The17? the17;
  DateTime? the18;
  String? the19;
  String? the20;
  String? productId;
  String? productname;
  dynamic productDesc;
  String? catId;
  The4? categoryName;
  dynamic defaultImageMobile;
  dynamic defaultImageDsk;
  dynamic brandName;
  dynamic manufacturer;
  dynamic manufacturePartNumber;
  dynamic modelNumber;
  String? deliverytime;
  String? vendorId;
  dynamic hsnCode;
  String? gstPer;
  dynamic abv;
  dynamic tastingNotes;
  The17? virtualProduct;
  DateTime? createdDt;
  String? linkProductCode;
  String? sameProductList;
  List<Map<String, String?>>? comb;
  dynamic img;

  ProductList({
    this.the0,
    this.the1,
    this.the2,
    this.the3,
    this.the4,
    this.the5,
    this.the6,
    this.the7,
    this.the8,
    this.the9,
    this.the10,
    this.the11,
    this.the12,
    this.the13,
    this.the14,
    this.the15,
    this.the16,
    this.the17,
    this.the18,
    this.the19,
    this.the20,
    this.productId,
    this.productname,
    this.productDesc,
    this.catId,
    this.categoryName,
    this.defaultImageMobile,
    this.defaultImageDsk,
    this.brandName,
    this.manufacturer,
    this.manufacturePartNumber,
    this.modelNumber,
    this.deliverytime,
    this.vendorId,
    this.hsnCode,
    this.gstPer,
    this.abv,
    this.tastingNotes,
    this.virtualProduct,
    this.createdDt,
    this.linkProductCode,
    this.sameProductList,
    this.comb,
    this.img,
  });

  factory ProductList.fromJson(Map<String, dynamic> json) => ProductList(
        the0: json["0"],
        the1: json["1"],
        the2: json["2"],
        the3: json["3"],
        the4: the4Values.map[json["4"]]!,
        the5: json["5"],
        the6: json["6"],
        the7: json["7"],
        the8: json["8"],
        the9: json["9"],
        the10: json["10"],
        the11: json["11"],
        the12: json["12"],
        the13: json["13"],
        the14: json["14"],
        the15: json["15"],
        the16: json["16"],
        the17: the17Values.map[json["17"]]!,
        the18: json["18"] == null ? null : DateTime.parse(json["18"]),
        the19: json["19"],
        the20: json["20"],
        productId: json["product_id"],
        productname: json["productname"],
        productDesc: json["product_desc"],
        catId: json["cat_id"],
        categoryName: the4Values.map[json["category_name"]]!,
        defaultImageMobile: json["default_image_mobile"],
        defaultImageDsk: json["default_image_dsk"],
        brandName: json["brand_name"],
        manufacturer: json["manufacturer"],
        manufacturePartNumber: json["manufacture_part_number"],
        modelNumber: json["model_number"],
        deliverytime: json["deliverytime"],
        vendorId: json["vendor_id"],
        hsnCode: json["hsn_code"],
        gstPer: json["gst_per"],
        abv: json["abv"],
        tastingNotes: json["tasting_notes"],
        virtualProduct: the17Values.map[json["virtual_product"]]!,
        createdDt: json["created_dt"] == null
            ? null
            : DateTime.parse(json["created_dt"]),
        linkProductCode: json["link_product_code"],
        sameProductList: json["same_product_list"],
        comb: json["comb"] == null
            ? []
            : List<Map<String, String?>>.from(json["comb"]!.map((x) =>
                Map.from(x).map((k, v) => MapEntry<String, String?>(k, v)))),
        img: json["IMG"],
      );

  Map<String, dynamic> toJson() => {
        "0": the0,
        "1": the1,
        "2": the2,
        "3": the3,
        "4": the4Values.reverse[the4],
        "5": the5,
        "6": the6,
        "7": the7,
        "8": the8,
        "9": the9,
        "10": the10,
        "11": the11,
        "12": the12,
        "13": the13,
        "14": the14,
        "15": the15,
        "16": the16,
        "17": the17Values.reverse[the17],
        "18": the18?.toIso8601String(),
        "19": the19,
        "20": the20,
        "product_id": productId,
        "productname": productname,
        "product_desc": productDesc,
        "cat_id": catId,
        "category_name": the4Values.reverse[categoryName],
        "default_image_mobile": defaultImageMobile,
        "default_image_dsk": defaultImageDsk,
        "brand_name": brandName,
        "manufacturer": manufacturer,
        "manufacture_part_number": manufacturePartNumber,
        "model_number": modelNumber,
        "deliverytime": deliverytime,
        "vendor_id": vendorId,
        "hsn_code": hsnCode,
        "gst_per": gstPer,
        "abv": abv,
        "tasting_notes": tastingNotes,
        "virtual_product": the17Values.reverse[virtualProduct],
        "created_dt": createdDt?.toIso8601String(),
        "link_product_code": linkProductCode,
        "same_product_list": sameProductList,
        "comb": comb == null
            ? []
            : List<dynamic>.from(comb!.map((x) =>
                Map.from(x).map((k, v) => MapEntry<String, dynamic>(k, v)))),
        "IMG": img,
      };
}

enum The4 { STRONG_BEER, MILD_BEER }

final the4Values =
    EnumValues({"MILD BEER": The4.MILD_BEER, "STRONG BEER": The4.STRONG_BEER});

class ImgClass {
  String? the0;
  String? the1;
  String? the2;
  String? the3;
  String? the4;
  String? the5;
  dynamic the6;
  dynamic the7;
  dynamic the8;
  dynamic the9;
  String? the10;
  String? the11;
  dynamic the12;
  String? the13;
  String? productImgId;
  String? productId;
  String? imageGalleryId;
  String? productsVariationsValueId;
  String? defaultImageMobile;
  String? defaultImageDesktop;
  dynamic title;
  dynamic caption;
  dynamic altText;
  dynamic etcInformation;
  String? imgId;
  String? smallImg;
  dynamic mediumImg;
  String? largeImg;

  ImgClass({
    this.the0,
    this.the1,
    this.the2,
    this.the3,
    this.the4,
    this.the5,
    this.the6,
    this.the7,
    this.the8,
    this.the9,
    this.the10,
    this.the11,
    this.the12,
    this.the13,
    this.productImgId,
    this.productId,
    this.imageGalleryId,
    this.productsVariationsValueId,
    this.defaultImageMobile,
    this.defaultImageDesktop,
    this.title,
    this.caption,
    this.altText,
    this.etcInformation,
    this.imgId,
    this.smallImg,
    this.mediumImg,
    this.largeImg,
  });

  factory ImgClass.fromJson(Map<String, dynamic> json) => ImgClass(
        the0: json["0"],
        the1: json["1"],
        the2: json["2"],
        the3: json["3"],
        the4: json["4"],
        the5: json["5"],
        the6: json["6"],
        the7: json["7"],
        the8: json["8"],
        the9: json["9"],
        the10: json["10"],
        the11: json["11"],
        the12: json["12"],
        the13: json["13"],
        productImgId: json["product_img_id"],
        productId: json["product_id"],
        imageGalleryId: json["image_gallery_id"],
        productsVariationsValueId: json["products_variations_value_id"],
        defaultImageMobile: json["default_image_mobile"],
        defaultImageDesktop: json["default_image_desktop"],
        title: json["title"],
        caption: json["caption"],
        altText: json["alt_text"],
        etcInformation: json["etc_information"],
        imgId: json["img_id"],
        smallImg: json["small_img"],
        mediumImg: json["medium_img"],
        largeImg: json["large_img"],
      );

  Map<String, dynamic> toJson() => {
        "0": the0,
        "1": the1,
        "2": the2,
        "3": the3,
        "4": the4,
        "5": the5,
        "6": the6,
        "7": the7,
        "8": the8,
        "9": the9,
        "10": the10,
        "11": the11,
        "12": the12,
        "13": the13,
        "product_img_id": productImgId,
        "product_id": productId,
        "image_gallery_id": imageGalleryId,
        "products_variations_value_id": productsVariationsValueId,
        "default_image_mobile": defaultImageMobile,
        "default_image_desktop": defaultImageDesktop,
        "title": title,
        "caption": caption,
        "alt_text": altText,
        "etc_information": etcInformation,
        "img_id": imgId,
        "small_img": smallImg,
        "medium_img": mediumImg,
        "large_img": largeImg,
      };
}

enum The17 { N }

final the17Values = EnumValues({"N": The17.N});

class Variation {
  String? the0;
  String? the1;
  String? the2;
  String? id;
  String? variationName;
  String? infoVar;
  List<Option>? options;

  Variation({
    this.the0,
    this.the1,
    this.the2,
    this.id,
    this.variationName,
    this.infoVar,
    this.options,
  });

  factory Variation.fromJson(Map<String, dynamic> json) => Variation(
        the0: json["0"],
        the1: json["1"],
        the2: json["2"],
        id: json["id"],
        variationName: json["variation_name"],
        infoVar: json["info_var"],
        options: json["OPTIONS"] == null
            ? []
            : List<Option>.from(
                json["OPTIONS"]!.map((x) => Option.fromJson(x))),
      );

  Map<String, dynamic> toJson() => {
        "0": the0,
        "1": the1,
        "2": the2,
        "id": id,
        "variation_name": variationName,
        "info_var": infoVar,
        "OPTIONS": options == null
            ? []
            : List<dynamic>.from(options!.map((x) => x.toJson())),
      };
}

class Option {
  String? the0;
  String? the1;
  String? the2;
  String? id;
  String? variationsId;
  String? variationsValue;

  Option({
    this.the0,
    this.the1,
    this.the2,
    this.id,
    this.variationsId,
    this.variationsValue,
  });

  factory Option.fromJson(Map<String, dynamic> json) => Option(
        the0: json["0"],
        the1: json["1"],
        the2: json["2"],
        id: json["id"],
        variationsId: json["variations_id"],
        variationsValue: json["variations_value"],
      );

  Map<String, dynamic> toJson() => {
        "0": the0,
        "1": the1,
        "2": the2,
        "id": id,
        "variations_id": variationsId,
        "variations_value": variationsValue,
      };
}

class EnumValues<T> {
  Map<String, T> map;
  late Map<T, String> reverseMap;

  EnumValues(this.map);

  Map<T, String> get reverse {
    reverseMap = map.map((k, v) => MapEntry(v, k));
    return reverseMap;
  }
}
Editor is loading...