diff --git a/lib/food_entry/food_entry_bloc.dart b/lib/food_entry/food_entry_bloc.dart index f40cbf5..44bd89f 100644 --- a/lib/food_entry/food_entry_bloc.dart +++ b/lib/food_entry/food_entry_bloc.dart @@ -84,7 +84,7 @@ class FoodEntryBloc extends Bloc { newList.add(newEntryWaiting); emit(PageState(foodEntries: newList)); - await responseFuture.then((response) { + await responseFuture.then((response) async { var index = newList .indexWhere((entryState) => entryState.id == newEntryWaiting.id); @@ -117,6 +117,10 @@ class FoodEntryBloc extends Bloc { newList.removeAt(index); newList.insert(index, newEntryFinishedWaiting); + + await storage.writeEntriesForDate(forDate, newList); + storage.addFoodEntryToLookupDatabase(newEntryFinishedWaiting); + emit(PageState(foodEntries: newList)); }); }