ProductDetails.fromJson constructor

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

Implementation

ProductDetails.fromJson(Map<String, dynamic> json) {
  sId = json['_id'];
  isMultiple = json['isMultiple'];
  if (json['categoryIds'] != null) {
    categoryIds = <CategoryIds>[];
    json['categoryIds'].forEach((v) {
      categoryIds!.add(new CategoryIds.fromJson(v));
    });
  }
  imageId = json['imageId'];
  productId = json['productId'];
  name = json['name'];
  description = json['description'];

  details = json['details'];
  packVariant = json['packVariant'];
  moq = json['moq'];
  skuId = json['skuId'];
  isOutofstock = json['isOutofstock'];
  type = json['type'];
  if (json['skuIds'] != null) {
    skuIds = <Null>[];
    json['skuIds'].forEach((v) {
      skuIds!.add(v);
    });
  }
  if (json['children'] != null) {
    children = <Null>[];
    json['children'].forEach((v) {
      children!.add(v);
    });
  }
  price = json['price'] != null ? new Price.fromJson(json['price']) : null;
  if (json['variantTypes'] != null) {
    variantTypes = <VariantTypes>[];
    json['variantTypes'].forEach((v) {
      variantTypes!.add(VariantTypes.fromJson(v));
    });
  }
  if (json['images'] != null) {
    images = <Images>[];
    json['images'].forEach((v) {
      images!.add(new Images.fromJson(v));
    });
  }
  if (json['mergeAttribute'] != null) {
    mergeAttribute = <MergeAttribute>[];
    json['mergeAttribute'].forEach((v) {
      mergeAttribute!.add(new MergeAttribute.fromJson(v));
    });
  }
  filterAttribute = json['filterAttribute'];
  sTypename = json['__typename'];
}