mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Added code property to Ingredient model. Generate ingredient.g.dart.
This commit is contained in:
@@ -20,7 +20,8 @@ MeasurementEntry _$MeasurementEntryFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$MeasurementEntryToJson(MeasurementEntry instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$MeasurementEntryToJson(MeasurementEntry instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'category': instance.category,
|
||||
'date': toDate(instance.date),
|
||||
|
||||
@@ -25,6 +25,10 @@ class Ingredient {
|
||||
@JsonKey(required: true)
|
||||
final int id;
|
||||
|
||||
/// Barcode of the product
|
||||
@JsonKey(required: true)
|
||||
final String code;
|
||||
|
||||
/// Name of the product
|
||||
@JsonKey(required: true)
|
||||
final String name;
|
||||
@@ -66,6 +70,7 @@ class Ingredient {
|
||||
|
||||
const Ingredient({
|
||||
required this.id,
|
||||
required this.code,
|
||||
required this.name,
|
||||
required this.creationDate,
|
||||
required this.energy,
|
||||
|
||||
@@ -11,6 +11,7 @@ Ingredient _$IngredientFromJson(Map<String, dynamic> json) {
|
||||
json,
|
||||
requiredKeys: const [
|
||||
'id',
|
||||
'code',
|
||||
'name',
|
||||
'creation_date',
|
||||
'energy',
|
||||
@@ -25,6 +26,7 @@ Ingredient _$IngredientFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
return Ingredient(
|
||||
id: json['id'] as int,
|
||||
code: json['code'] as String,
|
||||
name: json['name'] as String,
|
||||
creationDate: DateTime.parse(json['creation_date'] as String),
|
||||
energy: json['energy'] as int,
|
||||
@@ -38,8 +40,10 @@ Ingredient _$IngredientFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$IngredientToJson(Ingredient instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$IngredientToJson(Ingredient instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'code': instance.code,
|
||||
'name': instance.name,
|
||||
'creation_date': toDate(instance.creationDate),
|
||||
'energy': instance.energy,
|
||||
|
||||
Reference in New Issue
Block a user