convertResults method

  1. @override
Map<String, TaxonomyCategory> convertResults(
  1. dynamic jsonData
)
override

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, TaxonomyCategory> convertResults(dynamic jsonData) {
  if (jsonData is! Map<String, dynamic>) {
    return const {};
  }
  return jsonData
      .map<String, TaxonomyCategory>((String key, dynamic taxonomy) {
    if (taxonomy is! Map<String, dynamic>) {
      assert(false, 'Received JSON Category is not a Map');
      return MapEntry(key, TaxonomyCategory.fromJson({}));
    }
    return MapEntry(key, TaxonomyCategory.fromJson(taxonomy));
  });
}