getAndroidApps static method
Implementation
static Future<List<App>> getAndroidApps(String id) async {
String? content = await Util._fetchUrl(
"https://play.google.com/store/apps/dev?id=${id.replaceAll(" ", "+")}",
);
final List<App> apps = [];
if (content != null) {
int start = content.indexOf("AF_initDataCallback({key: 'ds:3',");
start = content.indexOf("data:", start) + 5;
final int end = content.indexOf(", sideChannel:", start);
content = content.substring(start, end);
for (dynamic item in jsonDecode(content)[0][1][0][21][0]) {
debugPrint(item[4].toString());
apps.add(
App(
id: item[0][0],
name: item[3],
category: item[5],
developerName: item[14],
rating: (item[4] as List).isEmpty
? 0
: (double.tryParse(item[4][0]) ?? 0),
imageUrl: item[1][3][2],
url: "https://play.google.com/store/apps/details?id=${item[0][0]}",
),
);
}
}
return apps;
}