StudyDeploymentStatus.fromJson constructor
StudyDeploymentStatus.fromJson(
- 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, from CARP Core Kotlin,
// the last part of the $type reflects the status:
// "__type": "dk.cachet.carp.deployments.application.StudyDeploymentStatus.Invited"
status.status ??= switch (status.$type?.split('.').last) {
'Invited' => StudyDeploymentStatusTypes.Invited,
'DeployingDevices' => StudyDeploymentStatusTypes.DeployingDevices,
'Running' => StudyDeploymentStatusTypes.Running,
'Stopped' => StudyDeploymentStatusTypes.Stopped,
_ => StudyDeploymentStatusTypes.Invited,
};
return status;
}