-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
class PackageManifest { | ||
final bool active; | ||
final List<IndividualPackage> packages; | ||
|
||
PackageManifest({this.active, this.packages}); | ||
|
||
factory PackageManifest.fromJson(Map<String, dynamic> parsedJson) { | ||
var list = parsedJson['packages'] as List; | ||
|
||
// print(list.runtimeType); | ||
List<IndividualPackage> packageList = | ||
list.map((i) => IndividualPackage.fromJson(i)).toList(); | ||
|
||
return PackageManifest(active: parsedJson['active'], packages: packageList); | ||
} | ||
} | ||
|
||
class IndividualPackage { | ||
final String id; | ||
final String altName; | ||
final String realName; | ||
final String version; | ||
final String description; | ||
final String hash; | ||
final String architecture; | ||
|
||
IndividualPackage( | ||
{this.id, | ||
this.altName, | ||
this.realName, | ||
this.version, | ||
this.description, | ||
this.hash, | ||
this.architecture}); | ||
factory IndividualPackage.fromJson(Map<String, dynamic> parsedJson) { | ||
return IndividualPackage( | ||
id: parsedJson['id'], | ||
altName: parsedJson['altName'], | ||
realName: parsedJson['realName'], | ||
version: parsedJson['version'], | ||
description: parsedJson['description'], | ||
hash: parsedJson['hash'], | ||
architecture: parsedJson['architecture']); | ||
} | ||
} |