choiceAnswer function
Implementation
dynamic choiceAnswer(Question q, List<String> selected, [Map<String,String> text = const {}]) {
if (q.options.any((o)=>o['other'] != null)) return {'selected':List<String>.from(selected),'otherText':{for(final o in q.options.where((o)=>o['other'] != null && selected.contains(o['id']))) o['id'] as String:text[o['id']] ?? ''}};
return q.type == 'single_choice' ? (selected.isEmpty ? '' : selected.first) : List<String>.from(selected);
}