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 toJson() => _$IngredientToJson(this); factory Ingredient.fromJson(Map json) => _$IngredientFromJson(json); }