getIosApps static method
Implementation
static Future<List<App>> getIosApps(String id) async {
String? content = await Util._fetchUrl(
"https://apps.apple.com/us/developer/x/$id?see-all=i-phonei-pad-apps",
);
final List<App> apps = [];
if (content != null) {
int start = content.indexOf('shoebox-media-api-cache-apps">') + 30;
final int end = content.indexOf("</script", start);
content = content.substring(start, end);
for (dynamic item in jsonDecode(
(jsonDecode(content) as Map<String, dynamic>).values.first)["d"]
[0]["relationships"]["ios-apps"]["data"]) {
final Map<String, dynamic> attributes = item["attributes"];
apps.add(
App(
id: item["id"],
name: attributes["name"],
category: attributes["genreDisplayName"],
developerName: attributes["artistName"],
rating:
double.tryParse(attributes["userRating"]["value"].toString()) ??
0,
imageUrl: (attributes["platformAttributes"]["ios"]["artwork"]["url"]
as String)
.replaceAll("{w}x{h}{c}.{f}", "512x0w.png"),
url: attributes["url"],
),
);
}
}
return apps;
}