2023-05-06 16:12:18 -04:00
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
import 'package:http/http.dart' as http;
|
|
|
|
|
|
|
|
class GithubApi {
|
|
|
|
static const baseUrl = "https://api.github.com";
|
|
|
|
|
|
|
|
static Future<String> getLatestTagName() async {
|
2023-10-12 13:17:53 -04:00
|
|
|
final response = await http.get(Uri.parse("$baseUrl/repos/Nutcake/ReCon/releases?per_page=1"));
|
2023-05-06 16:12:18 -04:00
|
|
|
if (response.statusCode != 200) return "";
|
2023-10-12 13:17:53 -04:00
|
|
|
final body = jsonDecode(response.body) as List;
|
|
|
|
if (body.isEmpty) return "";
|
|
|
|
return body.first["tag_name"] ?? "";
|
2023-05-06 16:12:18 -04:00
|
|
|
}
|
|
|
|
}
|