HealthAppTask constructor

HealthAppTask({
  1. String type = HealthUserTask.HEALTH_ASSESSMENT_TYPE,
  2. String? name,
  3. String title = '',
  4. String? description = '',
  5. String instructions = '',
  6. int? minutesToComplete,
  7. Duration? expire,
  8. bool notification = false,
  9. List<Measure>? measures,
  10. List<HealthDataType> types = const [],
})

Implementation

HealthAppTask({
  super.type = HealthUserTask.HEALTH_ASSESSMENT_TYPE,
  super.name,
  super.title,
  super.description,
  super.instructions,
  super.minutesToComplete,
  super.expire,
  super.notification,
  List<Measure>? measures,
  this.types = const [],
}) {
  measures ??= [];
  // if the list of measures doesn't already contains a health measure for the
  // list of health data types, add it.
  if (measures
          .firstWhere(
            (Measure measure) => measure.type == HealthSamplingPackage.HEALTH,
            orElse: () => Measure(type: 'none'),
          )
          .type !=
      HealthSamplingPackage.HEALTH) {
    measures.add(HealthSamplingPackage.getHealthMeasure(types));
  }
  super.measures = measures;
}