DeviceDeploymentStatus.fromJson constructor
DeviceDeploymentStatus.fromJson(
- Map<String, dynamic> json
)
Implementation
factory DeviceDeploymentStatus.fromJson(Map<String, dynamic> json) {
DeviceDeploymentStatus status = FromJsonFactory()
.fromJson<DeviceDeploymentStatus>(json);
// when this object was create from json deserialization,
// the last part of the $type reflects the status
status.status = switch (status.$type?.split('.').last) {
'Unregistered' => DeviceDeploymentStatusTypes.Unregistered,
'Registered' => DeviceDeploymentStatusTypes.Registered,
'NeedsRedeployment' => DeviceDeploymentStatusTypes.NeedsRedeployment,
'Deployed' => DeviceDeploymentStatusTypes.Deployed,
_ => DeviceDeploymentStatusTypes.Deployed,
};
return status;
}