setValue method
Sets value at ref, re-evaluates what depends on it and, when the
value changed, fires the question's xforms-value-changed actions.
midSurvey is kept for JavaRosa compatibility; it has no effect.
Implementation
void setValue(
AnswerValue? value,
TreeReference ref, {
bool midSurvey = true,
}) {
final node = mainInstance.resolveReference(ref)!;
final valueChanged = !_serializedEquals(node.value, value);
node.setAnswer(value);
final question = findQuestionByRef(ref, this);
final evaluated = triggerTriggerables(ref);
if (valueChanged && question != null) {
question.actionController.triggerActionsFromEvent(
FormEvents.xformsValueChanged,
this,
ref.parentRef,
null,
);
}
_dag.publishSummary('New value', ref, evaluated);
}