findQuestionByRef static method
The question bound to ref under element (repeat-agnostic when
element is the form).
Implementation
static QuestionDef? findQuestionByRef(
TreeReference ref,
FormElement element,
) {
if (element is FormDef) ref = ref.genericize();
if (element is QuestionDef) return ref == element.bind ? element : null;
for (final child in element.children) {
final found = findQuestionByRef(ref, child);
if (found != null) return found;
}
return null;
}