answerCurrent method
Answers the current question with value.
Implementation
AnswerResult answerCurrent(Object? value) {
final data = switch (value) {
null => null,
final AnswerValue v => v,
final String s => StringValue(s),
final List<String> values => MultipleItemsValue([
for (final v in values) Selection(v),
]),
final int i => IntegerValue(i),
final double d => DecimalValue(d),
final bool b => BooleanValue(b),
final DateTime d => DateValue(DateTime.utc(d.year, d.month, d.day)),
final SelectChoice c => SelectOneValue(Selection.ofChoice(c)),
_ => throw ArgumentError.value(value, 'value', 'unsupported answer'),
};
final index = _model.formIndex;
_log.info('Answer $data at ${index.reference}');
return _controller.answerQuestion(data, index: index, midSurvey: true);
}