TestResult.fromJson constructor

TestResult.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory TestResult.fromJson(Map<String, dynamic> json) {
  DateTime? createdOn;

  if (json['created_on'] != null) {
    createdOn = DateTime.fromMillisecondsSinceEpoch(json['created_on']);
  }

  List<CustomStep>? customStepsSeparated;

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

  return TestResult(
    assignedToId: json['assignedto_ids'],
    attachmentIds: List<int>.from(json['attachment_ids']),
    comment: json['comment'],
    createdBy: json['created_by'],
    createdOn: createdOn,
    customStepResults: customStepsSeparated,
    defects: json['defects'],
    elapsed: json['elapsed'],
    id: json['id'],
    statusId: json['status_id'],
    testId: json['test_id'],
    version: json['version'],
  );
}