fetchRelease method
- BuildChannel channel
override
Fetches the latest release for a given build channel.
Implementation
@override
Future<Release> fetchRelease(BuildChannel channel) async {
var response = await networkService
.get("$kLBPlannerWebsiteAdress/api/get_app_versions.php");
if (response.isNotOk) {
throw Exception("Failed to fetch release: ${response.statusCode}");
}
var json = response.body as JSON;
var channelRelease = json[channel.name] as JSON?;
if (channelRelease == null) {
throw Exception("Failed to fetch release: No release for channel");
}
/// Add the channel name to the release JSON for parsing.
channelRelease["channel"] = channel.name;
return Release.fromJson(channelRelease);
}