answerRobotoffQuestion method

void answerRobotoffQuestion(
  1. RobotoffQuestion question,
  2. InsightAnnotation? annotation
)

Implementation

void answerRobotoffQuestion(
  RobotoffQuestion question,
  InsightAnnotation? annotation,
) {
  robotoffQuestionsNotifier.value = robotoffQuestionsNotifier.value
      .map<RobotoffQuestion, InsightAnnotation?>((
        RobotoffQuestion key,
        InsightAnnotation? value,
      ) {
        if (key == question) {
          return MapEntry<RobotoffQuestion, InsightAnnotation?>(
            key,
            annotation,
          );
        }
        return MapEntry<RobotoffQuestion, InsightAnnotation?>(key, value);
      });

  _changed = _computeHasChanged();
  notifyListeners();
}