Created
May 5, 2022 11:41
-
-
Save saliouseck2009/223374fcf669d87bac38f371270d4fa2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, dynamic> toJson() { | |
List<Map>? orderProducts = this.orderProducts != null | |
? this.orderProducts!.map((i) => i.toJson()).toList() | |
: null; | |
return { | |
'pos_id': posId, | |
'sector_id': sectorId, | |
'seller_id': sellerId, | |
"date": date == null ? null : date!.toIso8601String(), | |
'motif_no_order': motifNoOrder, | |
'order_products': orderProducts | |
}; | |
} | |
OrderExtension.fromJson(Map<String, dynamic> json) | |
: posId = json['pos_id'], | |
sectorId = json['sector_id'], | |
sellerId = json['seller_id'], | |
date = DateTime.tryParse(json["date"]), | |
motifNoOrder = json['motif_no_order'], | |
orderProducts = json['order_products'] | |
.map((orderProduct) => OrderProductExtension.fromJson(orderProduct)) | |
.toList(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment