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(
|
||||
fields[0] as String,
|
||||
fields[1] as String,
|
||||
);
|
||||
)..completedOn = fields[2] as DateTime?;
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, RecipeSubStep obj) {
|
||||
writer
|
||||
..writeByte(2)
|
||||
..writeByte(3)
|
||||
..writeByte(0)
|
||||
..write(obj.name)
|
||||
..writeByte(1)
|
||||
..write(obj.description);
|
||||
..write(obj.description)
|
||||
..writeByte(2)
|
||||
..write(obj.completedOn);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -16,16 +16,17 @@ import 'package:pizzaplanner/util.dart';
|
|||
void main() async {
|
||||
await Hive.initFlutter();
|
||||
|
||||
Hive.registerAdapter(PizzaEventAdapter());
|
||||
Hive.registerAdapter(PizzaRecipeAdapter());
|
||||
Hive.registerAdapter(RecipeStepAdapter());
|
||||
Hive.registerAdapter(RecipeSubStepAdapter());
|
||||
Hive.registerAdapter(IngredientAdapter());
|
||||
Hive.registerAdapter(PizzaEventAdapter());
|
||||
|
||||
await Hive.openBox<PizzaEvent>("PizzaEvents");
|
||||
var pizzaRecipesBox = await Hive.openBox<PizzaRecipe>("PizzaRecipes");
|
||||
|
||||
if (pizzaRecipesBox.isEmpty){
|
||||
print("Load pizzas from yamls");
|
||||
pizzaRecipesBox.addAll(await getRecipes());
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ class PizzaEventPageState extends State<PizzaEventPage> {
|
|||
} else {
|
||||
subStep.completedOn = null;
|
||||
}
|
||||
await this.widget.pizzaEvent.delete();
|
||||
await this.widget.pizzaEvent.save();
|
||||
setState(() {});
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue