recipes can be added to db from createpage

This commit is contained in:
SomnusVeritas
2023-11-13 17:57:38 +01:00
parent 384744729b
commit 64e983bc59
5 changed files with 25 additions and 6 deletions

View File

@@ -4,6 +4,11 @@ import 'package:rezepte/services/providers/db/dbhelper.dart';
import '../../models/recipe.dart';
class RecipeListProvider extends ChangeNotifier {
RecipeListProvider() {
DbHelper.recipesChangedStream.listen((event) {
notifyListeners();
});
}
// final List<Recipe> _recipes = [];
// set recipes(List<Recipe> recipes) {
@@ -20,8 +25,7 @@ class RecipeListProvider extends ChangeNotifier {
// if (!silent) notifyListeners();
// }
void addRecipe(Recipe recipe, {silent = false}) {
void addRecipe(Recipe recipe) {
DbHelper.putRecipe(recipe);
if (!silent) notifyListeners();
}
}