clearInsightAnnotationsSaved method Null safety

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 RobotoffQuestionsQuery(barcode)
            .getRobotoffQuestionsForProduct();
    if (questions.isEmpty) {
      await DaoStringListMap(_localDatabase).removeKey(barcode);
    }
  }
}