TestCase.fromJson constructor
TestCase.fromJson(
- Map<String, dynamic> json
)
Implementation
factory TestCase.fromJson(Map<String, dynamic> json) {
DateTime? createdOn;
DateTime? updatedOn;
if (json['created_on'] != null) {
createdOn = DateTime.fromMillisecondsSinceEpoch(json['created_on']);
}
if (json['updated_on'] != null) {
updatedOn = DateTime.fromMillisecondsSinceEpoch(json['updated_on']);
}
Map<String, dynamic> customAttributes = {};
var customStepsSeparated = [];
for (final element in json.entries) {
if (element.key.contains("custom_")) {
customAttributes.putIfAbsent(element.key, () => element.value);
}
if (element.key == "custom_steps_separated" && element.value != null) {
customStepsSeparated = List.from(
element.value.map(
(stepJson) => TestCaseCustomStep.fromJson(stepJson),
),
);
customAttributes.update(element.key, (value) => customStepsSeparated);
}
}
return TestCase(
createdBy: json['created_by'],
createdOn: createdOn,
customAttributes: customAttributes['custom_attributes'],
displayOrder: json['display_order'],
estimate: json['estimate'],
estimateForecast: json['estimate_forecast'],
id: json['id'],
isDeleted: json['is_deleted'],
milestoneId: json['milestone_id'],
priorityId: json['priority_id'],
refs: json['refs'],
sectionId: json['section_id'],
suiteId: json['suite_id'],
templateId: json['template_id'],
title: json['title'],
typeId: json['type_id'],
updatedBy: json['updated_by'],
updatedOn: updatedOn,
);
}