import '../src/enums.dart' show Difficulty, Cuisine, MealCategory; import 'ingredient_list_entry.dart'; class Recipe { final int id; final String title; final String description; final Difficulty difficulty; final List ingredients; final List steps; final DateTime datePublished; final Duration prepTime; final Duration cookTime; final Duration totalTime; final List keywords; final MealCategory mealCategory; final Cuisine cuisine; Recipe({ this.id = -1, this.title = '', this.description = '', this.difficulty = Difficulty.notSelected, required this.datePublished, this.prepTime = const Duration(), this.cookTime = const Duration(), this.totalTime = const Duration(), this.mealCategory = MealCategory.notSelected, this.cuisine = Cuisine.notSelected, this.ingredients = const [], this.keywords = const [], this.steps = const [], }); Recipe copyWith({ int? id, String? title, String? description, Difficulty? difficulty, List? ingredients, List? steps, DateTime? datePublished, Duration? prepTime, Duration? cookTime, Duration? totalTime, List? keywords, MealCategory? mealCategory, Cuisine? cuisine, }) { return Recipe( id: id ?? this.id, title: title ?? this.title, description: description ?? this.description, difficulty: difficulty ?? this.difficulty, ingredients: ingredients != null ? List.from(ingredients) : List.from(this.ingredients), steps: steps != null ? List.from(steps) : List.from(this.steps), datePublished: datePublished ?? this.datePublished, prepTime: prepTime ?? this.prepTime, cookTime: cookTime ?? this.cookTime, totalTime: totalTime ?? this.totalTime, keywords: keywords != null ? List.from(keywords) : List.from(this.keywords), mealCategory: mealCategory ?? this.mealCategory, cuisine: cuisine ?? this.cuisine, ); } }