added all recipes to the pizza recipe box at first start

This commit is contained in:
broodjeaap89 2021-07-26 21:52:02 +02:00
parent 621a863f45
commit 02691290e6

View file

@ -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<PizzaEvent>("PizzaEvents");
await Hive.openBox<PizzaRecipe>("PizzaRecipes");
var pizzaRecipesBox = await Hive.openBox<PizzaRecipe>("PizzaRecipes");
if (pizzaRecipesBox.isEmpty){
pizzaRecipesBox.addAll(await getRecipes());
}
runApp(PizzaPlanner());