Order.fromJson constructor

Order.fromJson(
  1. String json
)

Implementation

Order.fromJson(String json) {
    Map<String, dynamic> map = jsonDecode(json);
    id = map["id"];
    customerId = map["cust_id"];
    stallId = map["stall_id"];
    dateTime = map["datetime"];
    code = map["code"];
    status = _parseJson(map["status"]);
    stall = _Stall.fromJson(map["stall"]);
    total = map["total"] is int ? (map["total"] as int).toDouble() : map["total"];
    items = (map["items"] as List).map((item) => OrderItem.fromJsonMap(item)).toList();
    customer = _Customer.fromJson(map["customer"]);
}