fromJson static method
Returns a new ProjectShortModel instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static ProjectShortModel? 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 "ProjectShortModel[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "ProjectShortModel[$key]" has a null value in JSON.');
});
return true;
}());
return ProjectShortModel(
id: mapValueOfType<String>(json, r'id')!,
name: mapValueOfType<String>(json, r'name')!,
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
isDeleted: mapValueOfType<bool>(json, r'isDeleted')!,
createdDate: mapDateTime(json, r'createdDate', r'')!,
createdById: mapValueOfType<String>(json, r'createdById')!,
globalId: mapValueOfType<int>(json, r'globalId')!,
type: ProjectTypeModel.fromJson(json[r'type'])!,
isFlakyAuto: mapValueOfType<bool>(json, r'isFlakyAuto')!,
workflowId: mapValueOfType<String>(json, r'workflowId')!,
description: mapValueOfType<String>(json, r'description'),
testCasesCount: mapValueOfType<int>(json, r'testCasesCount'),
sharedStepsCount: mapValueOfType<int>(json, r'sharedStepsCount'),
checkListsCount: mapValueOfType<int>(json, r'checkListsCount'),
autoTestsCount: mapValueOfType<int>(json, r'autoTestsCount'),
modifiedDate: mapDateTime(json, r'modifiedDate', r''),
modifiedById: mapValueOfType<String>(json, r'modifiedById'),
);
}
return null;
}