UserTask class abstract
A task the user needs to do, e.g. fill in a survey.
It is shown in the app's task list. A user task is the runtime form of an AppTask. It is created by a UserTaskFactory each time the app task is triggered, and put on the AppTaskController queue. The app shows it to the user and calls onStart, onCancel, onDone or onExpired as the user acts on it.
Key points:
- state follows UserTaskState; changes are emitted on stateEvents. Changes made by the controller are also on AppTaskController.userTaskEvents.
- The measures of AppTask.backgroundTask are collected by backgroundTaskExecutor, initialized when onStart is called.
- Subclasses can provide a widget for the task's UI.
- When done, a CompletedAppTask measurement with the result is added to the study's measurements.
- Implementers
Constructors
-
UserTask(AppTaskExecutor<
AppTask> executor) -
Creates a user task wrapping
executor, with a new id.
Properties
-
appTaskExecutor
→ AppTaskExecutor<
AppTask> -
The AppTaskExecutor this user task wraps.
no setter
- availableForUser → bool
-
Whether the user can do this task now.
no setter
- backgroundTaskExecutor ↔ BackgroundTaskExecutor
-
Collects the measures of AppTask.backgroundTask once started.
getter/setter pair
- description → String
-
no setter
- doneTime ↔ DateTime?
-
The time this task was marked as done in the onDone method.
getter/setter pair
- enqueued ↔ DateTime
-
The time this task was added to the queue.
getter/setter pair
- expiresIn → Duration?
-
The time left until this task expires, based on AppTask.expire.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasNotificationBeenCreated ↔ bool
-
Whether the NotificationManager has created a notification for it.
getter/setter pair
- hasWidget → bool
-
Whether this task has a widget to show to the user. False by default.
no setter
- id ↔ String
-
A unique id of this user task, a v4 UUID.
getter/setter pair
- instructions → String
-
no setter
- name → String
-
no setter
- notification → bool
-
Whether a notification should be shown for this task.
no setter
- result ↔ Data?
-
The result of this task, set by onDone. Null until then.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state ↔ UserTaskState
-
The state of this task. Setting it emits the new state on stateEvents.
getter/setter pair
-
stateEvents
→ Stream<
UserTaskState> -
A stream of state changes of this user task.
no setter
- studyDeploymentId → String?
-
The id of the study deployment this task belongs to.
no setter
- task → AppTask
-
The AppTask this user task was created from.
no setter
- title → String
-
no setter
- triggerTime ↔ DateTime
-
The time this task should trigger (typically becoming visible to the user).
getter/setter pair
- type → String
-
no setter
- widget → Widget?
-
The widget to be shown to the user as part of this task, if any.
Note that the user interface may not be available before the onStart
method has been called.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onCancel(
{bool dequeue = false}) → void - Called by the app when the user cancels this task.
-
onDone(
{bool dequeue = false, Data? result}) → void - Called by the app when the user has finished this task.
-
onExpired(
{bool dequeue = true}) → void - Called by the app when this task expires.
-
onNotification(
) → void - Called by the AppTaskController when the user taps the notification.
-
onStart(
) → void - Called by the app when the user starts this task.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited