Skip to content

HealthAppTask

An AppTask that asks the user to collect their own health data.

Add it to the protocol with a trigger, for example a PeriodicTrigger, on the phone. It shows up in the user's task list, and when the user starts it, it runs as a HealthUserTask: it asks for permission to read types and then collects them once.

Key points:

Inheritance
Annotations

Constructors

HealthAppTask.fromJson

HealthAppTask.fromJson(
  1. Map<String, dynamic> json
)

HealthAppTask

HealthAppTask({
  1. String type = AppTask.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 [],
})

Properties

fromJsonFunction

Function get fromJsonFunction
override

The function which can convert a JSON string to an object of this type.

types

List<HealthDataType> types
getter/setter pair

The health data types to collect.

Only used to create the health measure when measures does not already contain one.

Methods

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.