toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = new Map<String, dynamic>();
  if (this.billingAddress != null) {
    data['billingAddress'] = this.billingAddress!.toJson();
  }
  if (this.shippingAddress != null) {
    data['shippingAddress'] = this.shippingAddress!.toJson();
  }
  if (this.user != null) {
    data['user'] = this.user!.toJson();
  }
  data['orderStatus'] = this.orderStatus;
  data['paymentStatus'] = this.paymentStatus;
  data['orderType'] = this.orderType;
  if (this.price != null) {
    data['price'] = this.price!.toJson();
  }
  data['imageUrl'] = this.imageUrl;
  if (this.orderProducts != null) {
    data['orderProducts'] =
        this.orderProducts!.map((v) => v.toJson()).toList();
  }

  return data;
}