import 'dart:convert'; class OwnIngredientResponse { List bahanDimiliki; OwnIngredientResponse({ required this.bahanDimiliki, }); factory OwnIngredientResponse.fromJson(Map json) => OwnIngredientResponse( bahanDimiliki: List.from( json["Bahan dimiliki"].map((x) => BahanDimiliki.fromJson(x))), ); Map toJson() => { "Bahan dimiliki": List.from(bahanDimiliki.map((x) => x.toJson())), }; } class BahanDimiliki { int id; int recipeId; String name; double amount; String unitId; String state; BahanDimiliki({ required this.id, required this.recipeId, required this.name, required this.amount, required this.unitId, required this.state, }); factory BahanDimiliki.fromJson(Map json) => BahanDimiliki( id: json["id"], recipeId: json["recipe_id"], name: json["name"], amount: json["amount"]?.toDouble(), unitId: json["unit_id"], state: json["state"], ); Map toJson() => { "id": id, "recipe_id": recipeId, "name": name, "amount": amount, "unit_id": unitId, "state": state, }; }