Oops, forgot to store the entries that were scanned. They just disappeared after restarting the app
This commit is contained in:
parent
37cceb3a9b
commit
970cea8ba7
@ -84,7 +84,7 @@ class FoodEntryBloc extends Bloc<FoodEvent, PageState> {
|
|||||||
newList.add(newEntryWaiting);
|
newList.add(newEntryWaiting);
|
||||||
emit(PageState(foodEntries: newList));
|
emit(PageState(foodEntries: newList));
|
||||||
|
|
||||||
await responseFuture.then((response) {
|
await responseFuture.then((response) async {
|
||||||
var index = newList
|
var index = newList
|
||||||
.indexWhere((entryState) => entryState.id == newEntryWaiting.id);
|
.indexWhere((entryState) => entryState.id == newEntryWaiting.id);
|
||||||
|
|
||||||
@ -117,6 +117,10 @@ class FoodEntryBloc extends Bloc<FoodEvent, PageState> {
|
|||||||
|
|
||||||
newList.removeAt(index);
|
newList.removeAt(index);
|
||||||
newList.insert(index, newEntryFinishedWaiting);
|
newList.insert(index, newEntryFinishedWaiting);
|
||||||
|
|
||||||
|
await storage.writeEntriesForDate(forDate, newList);
|
||||||
|
storage.addFoodEntryToLookupDatabase(newEntryFinishedWaiting);
|
||||||
|
|
||||||
emit(PageState(foodEntries: newList));
|
emit(PageState(foodEntries: newList));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user