fetchConfig method
Implementation
Future<RateExperienceConfig> fetchConfig() async {
try {
var response = await _httpClient.fetchConfig();
Map<String, dynamic> data = response;
print("data as response");
List<Tag> tags = (data["tags"] as List<dynamic>)
.map((e) => Tag(e['id'], e['text']))
.toList();
List<LabelValue> valueReactions =
(data["valueReactions"] as List<dynamic>)
.map((e) => LabelValue(e['value'] as int, e['label'] as String))
.toList();
RateExperienceConfig experienceConfig = RateExperienceConfig(
tags,
data["numberOfStars"],
valueReactions,
data["title"],
data["postSubmitTitle"],
data["postSubmitText"],
data["isPremium"],
);
return experienceConfig;
} catch (e) {
print(e);
throw UnimplementedError("RateExperienceViewModel fetchConfig error");
}
}