TestCase.fromJson constructor

TestCase.fromJson(
  1. 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']);
  }
  var customStepsSeparated = <CustomStep>[];

  if (json['custom_steps_separated'] != null) {
    customStepsSeparated = List.from(
      json['custom_steps_separated'].map(
        (stepJson) => CustomStep.fromJson(stepJson),
      ),
    );
  }

  return TestCase(
    createdBy: json['created_by'],
    createdOn: createdOn,
    customExpected: json['custom_expected'],
    customPreconds: json['custom_preconds'],
    customSteps: json['custom_steps'],
    customStepsSeparated: customStepsSeparated,
    estimate: json['estimate'],
    estimateForecast: json['estimate_forecast'],
    id: json['id'],
    milestoneId: json['milestone_id'],
    priorityId: json['priority_id'],
    refs: json['refs'],
    sectionId: json['section_id'],
    suiteId: json['suite_id'],
    title: json['title'],
    typeId: json['type_id'],
    updatedBy: json['updated_by'],
    updatedOn: updatedOn,
  );
}