class NutritionData {
  final double energi;
  final double karbohidrat;
  final double protein;
  final double lemak;
  final double besi;
  final double vitamina;
  final double vitaminc;

  NutritionData(
      {required this.energi,
      required this.karbohidrat,
      required this.protein,
      required this.lemak,
      required this.besi,
      required this.vitamina,
      required this.vitaminc});

  factory NutritionData.fromJson(Map<String, dynamic> json) {
    return NutritionData(
      energi: double.parse(json['kalori']),
      karbohidrat: double.parse(json['karbohidrat']),
      protein: double.parse(json['protein']),
      lemak: double.parse(json['lemak']),
      besi: double.parse(json['besi']),
      vitamina: double.parse(json['vitamina']),
      vitaminc: double.parse(json['vitaminc']),
    );
  }
}
