fixed persistence by running build runner again...
This commit is contained in:
parent
cca65a5718
commit
319251c87e
3 changed files with 7 additions and 5 deletions
|
@ -19,17 +19,19 @@ class RecipeSubStepAdapter extends TypeAdapter<RecipeSubStep> {
|
||||||
return RecipeSubStep(
|
return RecipeSubStep(
|
||||||
fields[0] as String,
|
fields[0] as String,
|
||||||
fields[1] as String,
|
fields[1] as String,
|
||||||
);
|
)..completedOn = fields[2] as DateTime?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void write(BinaryWriter writer, RecipeSubStep obj) {
|
void write(BinaryWriter writer, RecipeSubStep obj) {
|
||||||
writer
|
writer
|
||||||
..writeByte(2)
|
..writeByte(3)
|
||||||
..writeByte(0)
|
..writeByte(0)
|
||||||
..write(obj.name)
|
..write(obj.name)
|
||||||
..writeByte(1)
|
..writeByte(1)
|
||||||
..write(obj.description);
|
..write(obj.description)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.completedOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -16,16 +16,17 @@ import 'package:pizzaplanner/util.dart';
|
||||||
void main() async {
|
void main() async {
|
||||||
await Hive.initFlutter();
|
await Hive.initFlutter();
|
||||||
|
|
||||||
|
Hive.registerAdapter(PizzaEventAdapter());
|
||||||
Hive.registerAdapter(PizzaRecipeAdapter());
|
Hive.registerAdapter(PizzaRecipeAdapter());
|
||||||
Hive.registerAdapter(RecipeStepAdapter());
|
Hive.registerAdapter(RecipeStepAdapter());
|
||||||
Hive.registerAdapter(RecipeSubStepAdapter());
|
Hive.registerAdapter(RecipeSubStepAdapter());
|
||||||
Hive.registerAdapter(IngredientAdapter());
|
Hive.registerAdapter(IngredientAdapter());
|
||||||
Hive.registerAdapter(PizzaEventAdapter());
|
|
||||||
|
|
||||||
await Hive.openBox<PizzaEvent>("PizzaEvents");
|
await Hive.openBox<PizzaEvent>("PizzaEvents");
|
||||||
var pizzaRecipesBox = await Hive.openBox<PizzaRecipe>("PizzaRecipes");
|
var pizzaRecipesBox = await Hive.openBox<PizzaRecipe>("PizzaRecipes");
|
||||||
|
|
||||||
if (pizzaRecipesBox.isEmpty){
|
if (pizzaRecipesBox.isEmpty){
|
||||||
|
print("Load pizzas from yamls");
|
||||||
pizzaRecipesBox.addAll(await getRecipes());
|
pizzaRecipesBox.addAll(await getRecipes());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,6 @@ class PizzaEventPageState extends State<PizzaEventPage> {
|
||||||
} else {
|
} else {
|
||||||
subStep.completedOn = null;
|
subStep.completedOn = null;
|
||||||
}
|
}
|
||||||
await this.widget.pizzaEvent.delete();
|
|
||||||
await this.widget.pizzaEvent.save();
|
await this.widget.pizzaEvent.save();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue