WorkoutGoal constructor

const WorkoutGoal({
  1. required WorkoutGoalType type,
  2. double? targetValue,
  3. Duration? targetDuration,
  4. WorkoutGoalUnit? unit,
})

Creates a new workout goal

Implementation

const WorkoutGoal({
  required this.type,
  this.targetValue,
  this.targetDuration,
  this.unit,
}) : assert(
        (type == WorkoutGoalType.distance && targetValue != null) ||
            (type == WorkoutGoalType.time && targetDuration != null) ||
            (type == WorkoutGoalType.energy && targetValue != null) ||
            type == WorkoutGoalType.open,
        'targetValue is required for distance type, targetDuration is required for time type, targetValue is required for energy type',
      );