From 02691290e66d980f30a67109f2441be3a900ab27 Mon Sep 17 00:00:00 2001 From: broodjeaap89 Date: Mon, 26 Jul 2021 21:52:02 +0200 Subject: [PATCH] added all recipes to the pizza recipe box at first start --- lib/main.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index ddbb8c6..c06105c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,6 +9,7 @@ import 'package:pizzaplanner/pages/PizzaEventsPage.dart'; import 'package:hive/hive.dart'; import 'package:hive_flutter/hive_flutter.dart'; +import 'package:pizzaplanner/util.dart'; void main() async { await Hive.initFlutter(); @@ -20,7 +21,11 @@ void main() async { Hive.registerAdapter(PizzaEventAdapter()); await Hive.openBox("PizzaEvents"); - await Hive.openBox("PizzaRecipes"); + var pizzaRecipesBox = await Hive.openBox("PizzaRecipes"); + + if (pizzaRecipesBox.isEmpty){ + pizzaRecipesBox.addAll(await getRecipes()); + } runApp(PizzaPlanner());