fooder-app/lib/models/product.dart

29 lines
678 B
Dart
Raw Permalink 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-30 20:44:50 +02:00
final double fiber;
2023-07-29 19:46:11 +02:00
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-30 20:44:50 +02:00
required this.fiber,
2023-07-29 19:46:11 +02:00
});
2023-07-29 23:54:51 +02:00
2023-08-28 14:45:32 +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,
fiber = map['fiber'] as double;
2023-07-29 19:46:11 +02:00
}