CreateRequest.fromJson constructor

CreateRequest.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory CreateRequest.fromJson(Map<String, Object?> json) => CreateRequest(
      reference:
          json["reference"] == null ? null : json["reference"] as String,
      description:
          json["description"] == null ? null : json["description"] as String,
      about: json["about"] == null ? null : json["about"] as String,
      taxCode: json["tax_code"] == null ? null : json["tax_code"] as String,
      category: json["category"] == null ? null : json["category"] as String,
      shipment: json["shipment"] == null
          ? null
          : ShipmentInput.fromJson(
              (json["shipment"] as Map).cast<String, Object?>(),
            ),
      dimensions: json["dimensions"] == null
          ? null
          : DimensionsInput.fromJson(
              (json["dimensions"] as Map).cast<String, Object?>(),
            ),
      unitDimension: json["unit_dimension"] == null
          ? null
          : json["unit_dimension"] as String,
      media: json["media"] == null
          ? null
          : MediaInput.fromJson(
              (json["media"] as Map).cast<String, Object?>(),
            ),
      attributes: json["attributes"] == null
          ? null
          : (json["attributes"] as List)
              .map(
                (item) => AttributeInput.fromJson(
                  (item as Map).cast<String, Object?>(),
                ),
              )
              .toList(),
      publish: json["publish"] == null ? null : json["publish"] as bool,
      customData: json["custom_data"] == null
          ? null
          : core.CustomData.fromJson(json["custom_data"]),
      type: Type.fromJson(json["type"]),
      name: json["name"] as String,
    );