SingleGoalWorkout constructor
SingleGoalWorkout({
- required WorkoutActivityType activityType,
- required WorkoutGoal goal,
- WorkoutLocationType? location,
- WorkoutSwimmingLocationType? swimmingLocation,
Creates a new single goal workout
Implementation
SingleGoalWorkout({
required this.activityType,
required this.goal,
this.location,
this.swimmingLocation,
}) : super(workoutType: WorkoutType.singleGoalWorkout) {
if (activityType == WorkoutActivityType.swimming) {
if (swimmingLocation == null || location != null) {
throw ArgumentError(
'Swimming workouts require swimmingLocation and must not have location set',
);
}
} else {
if (location == null || swimmingLocation != null) {
throw ArgumentError(
'Non-swimming workouts require location and must not have swimmingLocation set',
);
}
}
}