fromJson static method
Returns a new ProjectsProject instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static ProjectsProject? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "ProjectsProject[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "ProjectsProject[$key]" has a null value in JSON.');
});
return true;
}());
return ProjectsProject(
analytics: mapValueOfType<bool>(json, r'analytics'),
bucket: mapValueOfType<String>(json, r'bucket'),
cacheControl: mapValueOfType<String>(json, r'cacheControl'),
createdAt: mapValueOfType<int>(json, r'createdAt'),
currentDeploymentId: mapValueOfType<String>(json, r'currentDeploymentId'),
description: mapValueOfType<String>(json, r'description'),
forkedFrom: mapValueOfType<String>(json, r'forkedFrom'),
framework: mapValueOfType<String>(json, r'framework'),
hidden: mapValueOfType<bool>(json, r'hidden'),
hiddenReason: mapValueOfType<String>(json, r'hiddenReason'),
id: mapValueOfType<String>(json, r'id'),
key: mapValueOfType<String>(json, r'key'),
lastPurgeAt: mapValueOfType<int>(json, r'lastPurgeAt'),
license: mapValueOfType<String>(json, r'license'),
liveUrl: mapValueOfType<String>(json, r'liveUrl'),
name: mapValueOfType<String>(json, r'name'),
org: mapValueOfType<String>(json, r'org'),
repo: ProjectsRepo.fromJson(json[r'repo']),
slug: mapValueOfType<String>(json, r'slug'),
space: mapValueOfType<String>(json, r'space'),
starred: mapValueOfType<bool>(json, r'starred'),
status: mapValueOfType<String>(json, r'status'),
tags: mapCastOfType<String, String>(json, r'tags') ?? const {},
updatedAt: mapValueOfType<int>(json, r'updatedAt'),
upstream: mapValueOfType<String>(json, r'upstream'),
visibility: mapValueOfType<String>(json, r'visibility'),
);
}
return null;
}