clearInsightAnnotationsSaved method

Future<void> clearInsightAnnotationsSaved()

Implementation

Future<void> clearInsightAnnotationsSaved() async {
  final Map<String, List<String>> records = await DaoStringListMap(
    _localDatabase,
  ).getAll();
  for (final String barcode in records.keys) {
    final List<RobotoffQuestion> questions = await ProductQuestionsQuery(
      barcode,
    ).getQuestions(_localDatabase, 1);
    if (questions.isEmpty) {
      await DaoStringListMap(_localDatabase).removeKey(barcode);
    }
  }
}