22 lines
456 B
Dart
22 lines
456 B
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'ingredient_model.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class Ingredient {
|
|
String? name;
|
|
double? quantity;
|
|
@JsonKey(name: 'unit', includeIfNull: false)
|
|
String? unit;
|
|
|
|
Ingredient({
|
|
this.name,
|
|
this.quantity,
|
|
this.unit,
|
|
});
|
|
|
|
Map<String, dynamic> toJson() => _$IngredientToJson(this);
|
|
|
|
factory Ingredient.fromJson(Map<String, dynamic> json) =>
|
|
_$IngredientFromJson(json);
|
|
} |