AppTaskController class
A controller of UserTasks which is accessible in the userTaskQueue.
Constructors
- AppTaskController()
-
Get the singleton instance of AppTaskController.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- notificationsEnabled ↔ bool
-
Should this App Task Controller send notifications to the user.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- taskCompleted → int
-
The number of tasks completed so far.
no setter
- taskExpired → int
-
The number of tasks expired so far.
no setter
- taskPending → int
-
The number of tasks pending so far.
no setter
- taskTotal → int
-
The total number of tasks.
no setter
-
userTaskEvents
→ Stream<
UserTask> -
A stream of UserTask events generate whenever a user task change state,
like enqueued, dequeued, done, and expire.
no setter
-
userTaskQueue
→ List<
UserTask> -
The queue of UserTasks that the user need to attend to.
no setter
-
userTasks
→ List<
UserTask> -
The entire list of all UserTasks.
no setter
Methods
-
buffer(
AppTaskExecutor< AppTask> executor, TaskControl taskControl, {DateTime? triggerTime, bool sendNotification = true}) → void -
Buffer the
executor
originating fromtaskControl
for later scheduling. The buffered task executors is enqueued by calling enqueueBufferedTasks. -
dequeue(
String id) → void -
De-queue (remove) an UserTask with
id
from the userTasks. -
dispose(
) → void - Dispose this app task controller.
-
done(
String id, [Data? result]) → void -
Mark the UserTask with
id
as done.result
may contain the result obtained from the task. Note that a done task remains on the queue. If you want to remove a task from the queue, use the dequeue method. -
enqueue(
AppTaskExecutor< AppTask> executor, {DateTime? triggerTime, bool sendNotification = true}) → Future<UserTask?> -
Create and add a user task to the userTasks queue.
The user task is created from the AppTask that the
executor
is executing. -
enqueueBufferedTasks(
) → Future< void> -
Enqueue all tasks buffered with buffer.
This method is called by the
DeploymentExecutor
when a deployment is finished. It will sort the tasks based on their trigger time and then schedule the first N tasks where N is the number of available notification slots. -
expire(
String id) → void - Expire an UserTask. Note that an expired task remains on the queue. If you want to remove a task from the queue, use the dequeue method.
-
getUserTask(
String id) → UserTask? -
Get an UserTask from the userTasks based on its
id
. Returnsnull
if no task is found. -
initialize(
{bool enableNotifications = true}) → Future< void> - Initialize and set up the app controller.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onNotification(
String id) → void - Callback when a notification in the OS is clicked.
-
registerUserTaskFactory(
UserTaskFactory factory) → void - Register a UserTaskFactory which can create UserTasks for the specified AppTask types.
-
removeStudyDeployment(
String studyDeploymentId) → void - Removes all tasks for a study deployment from the queue and cancels all notifications generated for these tasks.
-
restoreQueue(
) → Future< bool> -
Restore the queue from persistent storage. Returns
true
if successful. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited