ProductDetailsModel.fromJson constructor Null safety

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

Implementation

factory ProductDetailsModel.fromJson(Map<String, dynamic> json) =>
    ProductDetailsModel(
      details: json["details"],
      shortDescription: json["shortDescription"],
      colorId: json["colorID"],
      sizeId: json["sizeID"],
      categories: json["categories"] == null
          ? null
          : List<Brand>.from(
              json["categories"].map((x) => Brand.fromJson(x))),
      brand: json["brand"] == null ? null : Brand.fromJson(json["brand"]),
      isAddedtoWishlist: json["isAddedtoWishlist"],
      imageList: json["imageList"] == null
          ? null
          : List<String>.from(json["imageList"].map((x) => x)),
      maxQty: json["maxQty"],
      reviewVisibility: json["reviewVisibility"],
      showOneClickOrder: json["showOneClickOrder"],
      minDeliveryPeriod: json["minDeliveryPeriod"],
      maxDeliveryPeriod: json["maxDeliveryPeriod"],
      periodName: json["periodName"],
      deliveryNote: json["deliveryNote"],
      remaining: json["remaining"],
      productCode: json["productCode"],
      skuCode: json["skuCode"],
      colorOptions: json["colorOptions"],
      features: json["features"] == null
          ? null
          : List<Feature>.from(
              json["features"].map((x) => Feature.fromJson(x))),
      rating: json["rating"],
      sizes: json["sizes"] == null
          ? null
          : List<Size>.from(json["sizes"].map((x) => Size.fromJson(x))),
      colors: json["colors"] == null
          ? null
          : List<ColorModel>.from(
              json["colors"].map((x) => ColorModel.fromJson(x))),
      preOrder: json["preOrder"],
      availabilityDate: json["availabilityDate"] == null
          ? null
          : DateTime.parse(json["availabilityDate"]),
      id: json["id"],
      productId: json["productID"],
      imageUrl: json["imageUrl"],
      imageThumbUrl: json["imageThumbUrl"],
      title: json["title"],
      seoTitle: json["seoTitle"],
      isOutOfStock: json["isOutOfStock"],
      price: json["price"] == null ? null : json["price"]!.toDouble(),
      finalPrice:
          json["finalPrice"] == null ? null : json["finalPrice"]!.toDouble(),
      hasDiscount: json["hasDiscount"],
      discountValue: json["discountValue"],
      discountType: json["discountType"],
      promoText: json["promoText"],
      bogoPromoText: json["bogoPromoText"],
      croppedImageUrl: json["croppedImageURL"],
      enableCropping: json["enableCropping"],
      size: json["size"],
      colorHexaCode: json["colorHexaCode"],
      color: json["color"],
    );