fooder-app/lib/models/product.dart

26 lines
568 B
Dart
Raw Normal View History

2023-07-29 19:46:11 +02:00
class Product {
final int id;
final String name;
final double calories;
final double protein;
final double carb;
final double fat;
2023-07-29 20:55:32 +02:00
Product({
2023-07-29 19:46:11 +02:00
required this.id,
2023-07-29 20:10:59 +02:00
required this.name,
required this.calories,
required this.protein,
required this.carb,
required this.fat,
2023-07-29 19:46:11 +02:00
});
2023-07-29 23:54:51 +02:00
Product.fromJson(Map<String, dynamic> map):
id = map['id'] as int,
name = map['name'] as String,
calories = map['calories'] as double,
protein = map['protein'] as double,
carb = map['carb'] as double,
fat = map['fat'] as double;
2023-07-29 19:46:11 +02:00
}