diff --git a/packages/health/lib/src/health_value_types.dart b/packages/health/lib/src/health_value_types.dart index 6a8b28819..2f4822145 100644 --- a/packages/health/lib/src/health_value_types.dart +++ b/packages/health/lib/src/health_value_types.dart @@ -140,6 +140,9 @@ class WorkoutHealthValue extends HealthValue { /// Might not be available for all workouts. HealthDataUnit? totalStepsUnit; + /// Raw workoutActivityType from native data format. + String? rawWorkoutActivityType; + WorkoutHealthValue( {required this.workoutActivityType, this.totalEnergyBurned, @@ -147,11 +150,13 @@ class WorkoutHealthValue extends HealthValue { this.totalDistance, this.totalDistanceUnit, this.totalSteps, - this.totalStepsUnit}); + this.totalStepsUnit, + this.rawWorkoutActivityType}); /// Create a [WorkoutHealthValue] based on a health data point from native data format. factory WorkoutHealthValue.fromHealthDataPoint(dynamic dataPoint) => WorkoutHealthValue( + rawWorkoutActivityType: dataPoint['workoutActivityType'] as String?, workoutActivityType: HealthWorkoutActivityType.values.firstWhere( (element) => element.name == dataPoint['workoutActivityType'], orElse: () => HealthWorkoutActivityType.OTHER, @@ -188,6 +193,7 @@ class WorkoutHealthValue extends HealthValue { @override String toString() => """$runtimeType - workoutActivityType: ${workoutActivityType.name}, + rawWorkoutActivityType: $rawWorkoutActivityType, totalEnergyBurned: $totalEnergyBurned, totalEnergyBurnedUnit: ${totalEnergyBurnedUnit?.name}, totalDistance: $totalDistance, @@ -198,6 +204,7 @@ class WorkoutHealthValue extends HealthValue { @override bool operator ==(Object other) => other is WorkoutHealthValue && + rawWorkoutActivityType == other.rawWorkoutActivityType && workoutActivityType == other.workoutActivityType && totalEnergyBurned == other.totalEnergyBurned && totalEnergyBurnedUnit == other.totalEnergyBurnedUnit && @@ -209,6 +216,7 @@ class WorkoutHealthValue extends HealthValue { @override int get hashCode => Object.hash( workoutActivityType, + rawWorkoutActivityType, totalEnergyBurned, totalEnergyBurnedUnit, totalDistance,