convertResults method
Creates a map of the correct taxonomy type from the raw JSON data.
Subclasses must implement this to return concrete taxonomy objects.
Implementation
@override
Map<String, TaxonomyAllergen> convertResults(dynamic jsonData) {
if (jsonData is! Map<String, dynamic>) {
return const {};
}
return jsonData
.map<String, TaxonomyAllergen>((String key, dynamic taxonomy) {
if (taxonomy is! Map<String, dynamic>) {
assert(false, 'Received JSON Allergen is not a Map');
return MapEntry(key, TaxonomyAllergen.fromJson({}));
}
return MapEntry(key, TaxonomyAllergen.fromJson(taxonomy));
});
}