refactor: improve code readability according to formatter

This commit is contained in:
Pun Butrach 2023-07-10 19:36:50 +07:00
parent b272988929
commit 6a45db8a38
No known key found for this signature in database
GPG key ID: 5F47D61B676D07F6
9 changed files with 55 additions and 48 deletions

View file

@ -73,20 +73,29 @@ class GithubAPI {
}
Future<Map<String, dynamic>?> getLatestManagerRelease(
String repoName,
) async {
String repoName,
) async {
try {
final response = await _dio.get(
'/repos/$repoName/releases',
);
final Map<String, dynamic> releases = response.data[0];
int updates = 0;
final String currentVersion = await ManagerAPI().getCurrentManagerVersion();
final String currentVersion =
await ManagerAPI().getCurrentManagerVersion();
while (response.data[updates]['tag_name'] != 'v$currentVersion') {
updates++;
}
for(int i = 1; i < updates; i++){
releases.update('body', (value) => value + '\n' + '# '+ response.data[i]['tag_name']+'\n' + response.data[i]['body']);
for (int i = 1; i < updates; i++) {
releases.update(
'body',
(value) =>
value +
'\n' +
'# ' +
response.data[i]['tag_name'] +
'\n' +
response.data[i]['body']);
}
return releases;
} on Exception catch (e) {