HealthData.fromHealthDataPoint constructor

HealthData.fromHealthDataPoint(
  1. HealthDataPoint healthDataPoint
)

Create a HealthData from a HealthDataPoint health data object.

Implementation

factory HealthData.fromHealthDataPoint(HealthDataPoint healthDataPoint) {
  String uuid =
      Uuid().v5(Uuid.NAMESPACE_URL, healthDataPoint.toJson().toString());
  return HealthData(
      uuid,
      healthDataPoint.value,
      healthDataPoint.unitString,
      healthDataPoint.typeString,
      healthDataPoint.dateFrom.toUtc(),
      healthDataPoint.dateTo.toUtc(),
      enumToString(healthDataPoint.sourcePlatform),
      healthDataPoint.sourceDeviceId,
      healthDataPoint.sourceId,
      healthDataPoint.sourceName);
}