Order.fromMap constructor

Order.fromMap(
  1. Map<String, dynamic> json
)

Implementation

factory Order.fromMap(Map<String, dynamic> json) => Order(
      id: json["id"],
      vendorOrderId: json["vendor_order_id"],
      reason: json["reason"],
      displayId: json["display_id"],
      stage: json["stage"],
      paymentType: json["payment_type"],
      origin: json["origin"] == null
          ? []
          : List<Destination>.from(
              json["origin"]!.map((x) => Destination.fromMap(x))),
      destination: json["destination"] == null
          ? []
          : List<Destination>.from(
              json["destination"]!.map((x) => Destination.fromMap(x))),
      returnAddress: json["return_address"],
      pricing:
          json["pricing"] == null ? null : Pricing.fromMap(json["pricing"]),
      distances: json["distances"] == null
          ? null
          : Distances.fromMap(json["distances"]),
      delivery: json["delivery"] == null
          ? null
          : Delivery.fromMap(json["delivery"]),
      vendor: json["vendor"] == null ? null : Vendor.fromMap(json["vendor"]),
      courier: json["courier"],
      trace: json["trace"],
      createdAt: json["created_at"] == null
          ? null
          : DateTime.parse(json["created_at"]).toLocal(),
    );