feat: add support for alternative ingredients; implement JSON storage and parsing logic
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-04 22:06:57 +02:00
parent 64f63b3392
commit 2c8d6b69ae
9 changed files with 180 additions and 9 deletions
@@ -23,6 +23,7 @@ class ParsedIngredient {
final String unit;
final String? note;
final List<IngredientSuggestion> suggestions;
final List<String> alternatives;
const ParsedIngredient({
required this.rawName,
@@ -30,6 +31,7 @@ class ParsedIngredient {
required this.unit,
this.note,
required this.suggestions,
this.alternatives = const [],
});
factory ParsedIngredient.fromJson(Map<String, dynamic> json) {
@@ -42,6 +44,9 @@ class ParsedIngredient {
suggestions: rawSuggestions
.map((s) => IngredientSuggestion.fromJson(s as Map<String, dynamic>))
.toList(),
alternatives: (json['alternatives'] as List<dynamic>? ?? [])
.map((a) => a as String)
.toList(),
);
}
}