Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saliouseck2009/223374fcf669d87bac38f371270d4fa2 to your computer and use it in GitHub Desktop.
Save saliouseck2009/223374fcf669d87bac38f371270d4fa2 to your computer and use it in GitHub Desktop.
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