saveAnswer method

bool saveAnswer(
  1. AnswerValue? data, {
  2. FormIndex? index,
  3. bool midSurvey = false,
})

Saves data at index (by default the current question) without checks; whether anything was saved.

Implementation

bool saveAnswer(
  AnswerValue? data, {
  FormIndex? index,
  bool midSurvey = false,
}) {
  index ??= model.formIndex;
  if (model.event(index) != FormEntryEvent.question) {
    throw StateError('Non-Question object at the form index.');
  }
  return _commitAnswer(
    model.treeElement(index)!,
    index,
    data,
    midSurvey: midSurvey,
  );
}