I want to ask about get the data in rapidapi. Previously I had succeeded in retrieving data from Rapidapi in a form like the image below, I retrieved the data in the default article:
Map data = jsonDecode(response.body);
// ignore: no_leading_underscores_for_local_identifiers
List _temp = [];
for (var i in data['results']) {
_temp.add(i['defaultArticle']);
}
return Clothes.clothesFromSnapshot(_temp);`
and now I’m confused about retrieving the data I want to retrieve now because the form of the JSON is different. How to retrieve the data shows?
2
Answers
If you have a JSON array where each object has a dynamic name in Flutter, you can’t directly access these objects without knowing their names. However, you can access them by iterating over the keys and values of each object. Try with this way: