checkVitals function
void
checkVitals({})
Implementation
void checkVitals({
required String value,
required VitalType vitalType,
required BehaviorSubject<dynamic> updateValue,
}) {
String? evaluatedValue;
final double parsedValue = double.parse(value).toDouble();
switch (vitalType) {
case VitalType.pulse:
if (parsedValue < normalPulseRange.lowerBound) evaluatedValue = lowText;
if (parsedValue >= normalPulseRange.lowerBound &&
parsedValue <= normalPulseRange.upperBound) {
evaluatedValue = normalText;
}
if (parsedValue > normalPulseRange.upperBound) evaluatedValue = highText;
break;
case VitalType.systolicBloodPressure:
if (parsedValue < normalBloodPressureRange.lowerBound) {
evaluatedValue = lowText;
}
if (parsedValue >= normalBloodPressureRange.lowerBound &&
parsedValue <= normalBloodPressureRange.upperBound) {
evaluatedValue = normalText;
}
if (parsedValue > normalBloodPressureRange.upperBound) {
evaluatedValue = highText;
}
break;
case VitalType.diastolicBloodPressure:
if (parsedValue < normalBloodPressureRange.lowerBound) {
evaluatedValue = lowText;
}
if (parsedValue >= normalBloodPressureRange.lowerBound &&
parsedValue <= normalBloodPressureRange.upperBound) {
evaluatedValue = normalText;
}
if (parsedValue > normalBloodPressureRange.upperBound) {
evaluatedValue = highText;
}
break;
case VitalType.respiratoryRate:
if (parsedValue < normalRespiratoryRateRange.lowerBound) {
evaluatedValue = lowText;
}
if (parsedValue >= normalRespiratoryRateRange.lowerBound &&
parsedValue <= normalRespiratoryRateRange.upperBound) {
evaluatedValue = normalText;
}
if (parsedValue > normalRespiratoryRateRange.upperBound) {
evaluatedValue = highText;
}
break;
case VitalType.temperature:
if (parsedValue < normalTemperatureRange.lowerBound) {
evaluatedValue = lowText;
}
if (parsedValue >= normalTemperatureRange.lowerBound &&
parsedValue <= normalTemperatureRange.upperBound) {
evaluatedValue = normalText;
}
if (parsedValue > normalTemperatureRange.upperBound) {
evaluatedValue = highText;
}
break;
case VitalType.bmi:
if (parsedValue < normalBMIRange.lowerBound) evaluatedValue = lowText;
if (parsedValue >= normalBMIRange.lowerBound &&
parsedValue <= normalBMIRange.upperBound) {
evaluatedValue = normalText;
}
if (parsedValue > normalBMIRange.upperBound) evaluatedValue = highText;
break;
case VitalType.bloodOxygen:
if (parsedValue < normalSpo2Range.lowerBound) evaluatedValue = lowText;
if (parsedValue >= normalSpo2Range.lowerBound &&
parsedValue <= normalSpo2Range.upperBound) {
evaluatedValue = normalText;
}
if (parsedValue > normalSpo2Range.upperBound) evaluatedValue = highText;
break;
}
updateValue.add(evaluatedValue);
}