File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,28 @@ class Cocktail {
5757 shakerNeeded: apiContent.asMap["mixing" ] == "YES" ,
5858 );
5959
60+ /// Creates a copy of this Cocktail but with the given fields replaced with the new values.
61+ Cocktail copyWith (
62+ String ? name,
63+ List <CocktailIngredient >? ingredients,
64+ String ? recipe,
65+ List <Image >? image,
66+ String ? author,
67+ GlassType ? glassType,
68+ bool ? shakerNeeded,
69+ String ? description,
70+ ) =>
71+ Cocktail (
72+ name: name ?? this .name,
73+ ingredients: ingredients ?? this .ingredients,
74+ recipe: recipe ?? this .recipe,
75+ image: image ?? this .image,
76+ author: author ?? this .author,
77+ glassType: glassType ?? this .glassType,
78+ shakerNeeded: shakerNeeded ?? this .shakerNeeded,
79+ description: description ?? this .description,
80+ );
81+
6082 /// All the alcoholic ingredients in the cocktail.
6183 List <GenericIngredient > get alcohols => ingredients
6284 .where ((element) => element.ingredient.isAlcoholic)
You can’t perform that action at this time.
0 commit comments