Users can now choose whether or not to save response results

This commit is contained in:
Ankit Mahato
2023-05-04 12:49:34 +05:30
parent 464e6e8c20
commit 26207a9fc7
3 changed files with 12 additions and 7 deletions

View File

@ -188,10 +188,15 @@ class CollectionStateNotifier extends StateNotifier<List<RequestModel>?> {
}
Future<void> saveData() async {
final saveResponse =
ref.read(settingsProvider.select((value) => value.saveResponses));
final ids = getIds();
await hiveHandler.setIds(ids);
for (var e in state!) {
await hiveHandler.setRequestModel(e.id, e.toJson());
await hiveHandler.setRequestModel(
e.id,
e.toJson(includeResponse: saveResponse),
);
}
await hiveHandler.removeUnused();
}