HealthDataPoint constructor
HealthDataPoint({
- required HealthValue value,
- required HealthDataType type,
- required HealthDataUnit unit,
- required DateTime dateFrom,
- required DateTime dateTo,
- required HealthPlatformType sourcePlatform,
- required String sourceDeviceId,
- required String sourceId,
- required String sourceName,
- bool isManualEntry = false,
- WorkoutSummary? workoutSummary,
Implementation
HealthDataPoint({
required this.value,
required this.type,
required this.unit,
required this.dateFrom,
required this.dateTo,
required this.sourcePlatform,
required this.sourceDeviceId,
required this.sourceId,
required this.sourceName,
this.isManualEntry = false,
this.workoutSummary,
}) {
// set the value to minutes rather than the category
// returned by the native API
if (type == HealthDataType.MINDFULNESS ||
type == HealthDataType.HEADACHE_UNSPECIFIED ||
type == HealthDataType.HEADACHE_NOT_PRESENT ||
type == HealthDataType.HEADACHE_MILD ||
type == HealthDataType.HEADACHE_MODERATE ||
type == HealthDataType.HEADACHE_SEVERE ||
type == HealthDataType.SLEEP_IN_BED ||
type == HealthDataType.SLEEP_ASLEEP ||
type == HealthDataType.SLEEP_AWAKE ||
type == HealthDataType.SLEEP_DEEP ||
type == HealthDataType.SLEEP_LIGHT ||
type == HealthDataType.SLEEP_REM ||
type == HealthDataType.SLEEP_OUT_OF_BED) {
value = _convertMinutes();
}
}