Survey.fromMap constructor
Implementation
factory Survey.fromMap(Map<String, dynamic> map) {
final List<ChoiceItem> choices = [];
if (map.containsKey('options')) {
final choiceMap = map['options'] as Map<String, dynamic>;
choiceMap.forEach(
(key, value) => choices.add(ChoiceItem(id: key, text: value)),
);
}
return Survey(
question: map['question'] ?? '',
choices: choices,
);
}