Skip to content

CompletedAppTask

The measurement collected when the user completes an AppTask.

taskData holds the result of the task (e.g. survey answers), or null if the task has no result. Its JSON type is dk.cachet.carp.completedapptask.<taskType>, so you can trigger on a specific type of task with a SamplingEventTrigger.

Inheritance
Annotations

Constructors

CompletedAppTask.fromJson

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

CompletedAppTask.fromUserTask

CompletedAppTask.fromUserTask(
  1. UserTask userTask
)

Creates a completed app task based on the given userTask.

CompletedAppTask

CompletedAppTask({
  1. required String taskName,
  2. required String taskType,
  3. Data? taskData,
})

Creates a completed app task with the given taskName and taskType, and optional taskData.

Properties

completedAt

DateTime completedAt
getter/setter pair

The time when the task was completed, in UTC. Set on creation.

fromJsonFunction

Function get fromJsonFunction
override

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

jsonType

String get jsonType
override

Return the __type to be used for JSON serialization of this class. Default is runtimeType. Only specify this if you need another type.

taskType

String taskType
getter/setter pair

The type of AppTask which was completed, if specified.

Known types are the *_TYPE constants of AppTask:

  • informed_consent - a task collecting informed consent from the user
  • survey - a survey task
  • cognition - a cognitive assessment task
  • audio - an audio task
  • video - a video task
  • image - an image task
  • health - a task collecting health data
  • sensing - a task collecting sensing data

Methods

equivalentTo

bool equivalentTo(
  1. Data other
)
override

Is this data equivalent to other?

This is a custom 'soft' equal (==) operator used to compare two data objects. Used in triggering when some data is collected. Override in subclasses to provide custom equivalence checking.

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.