ItemModel.fromJson constructor

ItemModel.fromJson(
  1. dynamic json
)

Implementation

factory ItemModel.fromJson(dynamic json) {
  return ItemModel(
    id: json["id"],
    storeId: json["storeId"],
    name: json["name"],
    thumbnail: json["thumbnail"],
    description: json["description"],
    isSoldOut: json["isSoldOut"],
    updatedAt: DateTime.parse(json["updatedAt"]).toLocal(),
    createdAt: DateTime.parse(json["createdAt"]).toLocal(),
    options: (json["options"] as Iterable).map(ItemOptionModel.fromJson),
  );
}