WorkoutHealthValue.fromJson constructor
WorkoutHealthValue.fromJson(
- dynamic json
Implementation
factory WorkoutHealthValue.fromJson(json) {
return WorkoutHealthValue(
HealthWorkoutActivityType.values.firstWhere(
(element) => element.name == json['workoutActivityType']),
json['totalEnergyBurned'] != null
? (json['totalEnergyBurned'] as num).toInt()
: null,
json['totalEnergyBurnedUnit'] != null
? HealthDataUnit.values.firstWhere(
(element) => element.name == json['totalEnergyBurnedUnit'])
: null,
json['totalDistance'] != null
? (json['totalDistance'] as num).toInt()
: null,
json['totalDistanceUnit'] != null
? HealthDataUnit.values.firstWhere(
(element) => element.name == json['totalDistanceUnit'])
: null);
}