StudyDeploymentStatus.fromJson constructor

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

Implementation

factory StudyDeploymentStatus.fromJson(Map<String, dynamic> json) {
  StudyDeploymentStatus status =
      FromJsonFactory().fromJson<StudyDeploymentStatus>(json);

  // when this object was create from json deserialization,
  // the last part of the $type reflects the status
  switch (status.$type?.split('.').last) {
    case 'Invited':
      status.status = StudyDeploymentStatusTypes.Invited;
      break;
    case 'DeployingDevices':
      status.status = StudyDeploymentStatusTypes.DeployingDevices;
      break;
    case 'DeploymentReady':
      status.status = StudyDeploymentStatusTypes.DeploymentReady;
      break;
    case 'Stopped':
      status.status = StudyDeploymentStatusTypes.Stopped;
      break;
    default:
      status.status = StudyDeploymentStatusTypes.Invited;
  }
  return status;
}