@@ -44,9 +44,8 @@ class Icon {
44
44
_fileExtension = path.split ('.' ).last;
45
45
}
46
46
47
- String getFilename (String appId) => (type == _symbolicType)
48
- ? '$appId -symbolic.$_fileExtension '
49
- : '$appId .$_fileExtension ' ;
47
+ String getFilename (String appId) =>
48
+ (type == _symbolicType) ? '$appId -symbolic.$_fileExtension ' : '$appId .$_fileExtension ' ;
50
49
}
51
50
52
51
class GithubReleases {
@@ -75,8 +74,7 @@ class GithubReleases {
75
74
final releaseJsonContent = (await http.get (Uri (
76
75
scheme: 'https' ,
77
76
host: 'api.github.com' ,
78
- path:
79
- '/repos/$githubReleaseOrganization /$githubReleaseProject /releases' )))
77
+ path: '/repos/$githubReleaseOrganization /$githubReleaseProject /releases' )))
80
78
.body;
81
79
final decodedJson = jsonDecode (releaseJsonContent) as List ;
82
80
@@ -87,23 +85,19 @@ class GithubReleases {
87
85
await Future .forEach <dynamic >(decodedJson, (dynamic releaseDynamic) async {
88
86
final releaseMap = releaseDynamic as Map ;
89
87
90
- final releaseDateAndTime =
91
- DateTime .parse (releaseMap['published_at' ] as String );
92
- final releaseDateString =
93
- releaseDateAndTime.toIso8601String ().split ('T' ).first;
88
+ final releaseDateAndTime = DateTime .parse (releaseMap['published_at' ] as String );
89
+ final releaseDateString = releaseDateAndTime.toIso8601String ().split ('T' ).first;
94
90
95
91
if (latestReleaseAssetDate == null ||
96
92
(latestReleaseAssetDate? .compareTo (releaseDateAndTime) == - 1 )) {
97
- final assets =
98
- await _parseGithubReleaseAssets (releaseMap['assets' ] as List );
93
+ final assets = await _parseGithubReleaseAssets (releaseMap['assets' ] as List );
99
94
if (assets != null ) {
100
95
_latestReleaseAssets = assets;
101
96
latestReleaseAssetDate = releaseDateAndTime;
102
97
}
103
98
}
104
99
105
- releases.add (Release (
106
- version: releaseMap['name' ] as String , date: releaseDateString));
100
+ releases.add (Release (version: releaseMap['name' ] as String , date: releaseDateString));
107
101
});
108
102
109
103
if (releases.isNotEmpty || canBeEmpty) {
@@ -124,8 +118,7 @@ class GithubReleases {
124
118
final downloadUrl = amMap['browser_download_url' ] as String ;
125
119
final filename = amMap['name' ] as String ;
126
120
final fileExtension = filename.substring (filename.indexOf ('.' ) + 1 );
127
- final filenameWithoutExtension =
128
- filename.substring (0 , filename.indexOf ('.' ));
121
+ final filenameWithoutExtension = filename.substring (0 , filename.indexOf ('.' ));
129
122
130
123
final arch = filenameWithoutExtension.endsWith ('aarch64' )
131
124
? CPUArchitecture .aarch64
@@ -221,8 +214,7 @@ class FlatpakMeta {
221
214
: _localReleases = localReleases,
222
215
_localReleaseAssets = localReleaseAssets {
223
216
if (githubReleaseOrganization != null && githubReleaseProject != null ) {
224
- _githubReleases =
225
- GithubReleases (githubReleaseOrganization! , githubReleaseProject! );
217
+ _githubReleases = GithubReleases (githubReleaseOrganization! , githubReleaseProject! );
226
218
}
227
219
}
228
220
@@ -231,20 +223,17 @@ class FlatpakMeta {
231
223
final releases = List <Release >.empty (growable: true );
232
224
if (addedTodaysVersion != null ) {
233
225
releases.add (Release (
234
- version: addedTodaysVersion,
235
- date: DateTime .now ().toIso8601String ().split ("T" ).first));
226
+ version: addedTodaysVersion, date: DateTime .now ().toIso8601String ().split ("T" ).first));
236
227
}
237
228
if (fetchReleasesFromGithub) {
238
229
if (_githubReleases == null ) {
239
230
throw Exception (
240
231
'Metadata must include Github repository info if fetching releases from Github.' );
241
232
}
242
- releases.addAll (
243
- await _githubReleases! .getReleases (addedTodaysVersion != null ));
233
+ releases.addAll (await _githubReleases! .getReleases (addedTodaysVersion != null ));
244
234
} else {
245
235
if (_localReleases == null && addedTodaysVersion == null ) {
246
- throw Exception (
247
- 'Metadata must include releases if not fetching releases from Github.' );
236
+ throw Exception ('Metadata must include releases if not fetching releases from Github.' );
248
237
}
249
238
if (_localReleases? .isNotEmpty ?? false ) {
250
239
releases.addAll (_localReleases! );
@@ -253,8 +242,7 @@ class FlatpakMeta {
253
242
return releases;
254
243
}
255
244
256
- Future <List <ReleaseAsset >?> getLatestReleaseAssets (
257
- bool fetchReleasesFromGithub) async {
245
+ Future <List <ReleaseAsset >?> getLatestReleaseAssets (bool fetchReleasesFromGithub) async {
258
246
if (fetchReleasesFromGithub) {
259
247
if (_githubReleases == null ) {
260
248
throw Exception (
@@ -263,8 +251,7 @@ class FlatpakMeta {
263
251
return await _githubReleases! .getLatestReleaseAssets ();
264
252
} else {
265
253
if (_localReleases == null ) {
266
- throw Exception (
267
- 'Metadata must include releases if not fetching releases from Github.' );
254
+ throw Exception ('Metadata must include releases if not fetching releases from Github.' );
268
255
}
269
256
return _localReleaseAssets;
270
257
}
@@ -276,24 +263,20 @@ class FlatpakMeta {
276
263
return FlatpakMeta (
277
264
appId: json['appId' ] as String ,
278
265
lowercaseAppName: json['lowercaseAppName' ] as String ,
279
- githubReleaseOrganization:
280
- json['githubReleaseOrganization' ] as String ? ,
266
+ githubReleaseOrganization: json['githubReleaseOrganization' ] as String ? ,
281
267
githubReleaseProject: json['githubReleaseProject' ] as String ? ,
282
268
localReleases: skipLocalReleases
283
269
? null
284
270
: (json['localReleases' ] as List ? )? .map ((dynamic r) {
285
271
final rMap = r as Map ;
286
- return Release (
287
- version: rMap['version' ] as String ,
288
- date: rMap['date' ] as String );
272
+ return Release (version: rMap['version' ] as String , date: rMap['date' ] as String );
289
273
}).toList (),
290
274
localReleaseAssets: skipLocalReleases
291
275
? null
292
276
: (json['localReleaseAssets' ] as List ? )? .map ((dynamic ra) {
293
277
final raMap = ra as Map ;
294
278
final archString = raMap['arch' ] as String ;
295
- final arch = (archString ==
296
- CPUArchitecture .x86_64.flatpakArchCode)
279
+ final arch = (archString == CPUArchitecture .x86_64.flatpakArchCode)
297
280
? CPUArchitecture .x86_64
298
281
: (archString == CPUArchitecture .aarch64.flatpakArchCode)
299
282
? CPUArchitecture .aarch64
@@ -302,11 +285,10 @@ class FlatpakMeta {
302
285
throw Exception (
303
286
'Architecture must be either "${CPUArchitecture .x86_64 .flatpakArchCode }" or "${CPUArchitecture .aarch64 .flatpakArchCode }"' );
304
287
}
305
- final tarballFile = File (
306
- '${jsonFile .parent .path }/${raMap ['tarballPath' ] as String }' );
288
+ final tarballFile =
289
+ File ( '${jsonFile .parent .path }/${raMap ['tarballPath' ] as String }' );
307
290
final tarballPath = tarballFile.absolute.path;
308
- final preShasum =
309
- Process .runSync ('shasum' , ['-a' , '256' , tarballPath]);
291
+ final preShasum = Process .runSync ('shasum' , ['-a' , '256' , tarballPath]);
310
292
final shasum = preShasum.stdout.toString ().split (' ' ).first;
311
293
if (preShasum.exitCode != 0 ) {
312
294
throw Exception (preShasum.stderr);
@@ -321,17 +303,14 @@ class FlatpakMeta {
321
303
appStreamPath: json['appStreamPath' ] as String ,
322
304
desktopPath: json['desktopPath' ] as String ,
323
305
icons: (json['icons' ] as Map ).entries.map ((mapEntry) {
324
- return Icon (
325
- type: mapEntry.key as String , path: mapEntry.value as String );
306
+ return Icon (type: mapEntry.key as String , path: mapEntry.value as String );
326
307
}).toList (),
327
308
freedesktopRuntime: json['freedesktopRuntime' ] as String ,
328
309
buildCommandsAfterUnpack: (json['buildCommandsAfterUnpack' ] as List ? )
329
310
? .map ((dynamic bc) => bc as String )
330
311
.toList (),
331
312
extraModules: json['extraModules' ] as List ? ,
332
- finishArgs: (json['finishArgs' ] as List )
333
- .map ((dynamic fa) => fa as String )
334
- .toList ());
313
+ finishArgs: (json['finishArgs' ] as List ).map ((dynamic fa) => fa as String ).toList ());
335
314
} catch (e) {
336
315
throw Exception ('Could not parse JSON file, due to this error:\n $e ' );
337
316
}
0 commit comments