AppTaskController class

Keeps the queue of UserTasks that the user needs to do.

A singleton. When an AppTask is triggered, its AppTaskExecutor is wrapped in a UserTask by a UserTaskFactory and enqueued here. The app shows userTaskQueue to the user (e.g., as a task list) and listens to userTaskEvents for changes.

Key points:

See also UserTask, whose callbacks the app calls to start and finish a task.

Constructors

AppTaskController()
Returns the singleton AppTaskController.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
notificationManager → NotificationManager
The client's notification controller for sending notifications to the user.
no setter
notificationsEnabled → bool
Whether this controller sends notifications to the user.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
taskCompleted → int
The number of done tasks in the userTaskQueue.
no setter
taskExpired → int
The number of expired tasks in the userTaskQueue.
no setter
taskPending → int
The number of UserTaskState.enqueued tasks in the userTaskQueue.
no setter
taskTotal → int
The number of tasks in the userTaskQueue.
no setter
userTaskEvents → Stream<UserTask>
Emits a UserTask each time the controller changes it.
no setter
userTaskQueue → List<UserTask>
The UserTasks whose trigger time has passed.
no setter
userTasks → List<UserTask>
All UserTasks, including those scheduled to trigger in the future.
no setter

Methods

buffer(AppTaskExecutor<AppTask> executor, TaskControl taskControl, {DateTime? triggerTime, bool sendNotification = true}) → void
Buffers executor from taskControl to be enqueued later.
dequeue(String id) → void
Removes the UserTask with id and cancels its notification.
dispose() → void
Stops the expiry check and closes userTaskEvents.
done(String id, [Data? result]) → void
Marks the UserTask with id as done, with an optional result.
enqueue(AppTaskExecutor<AppTask> executor, {DateTime? triggerTime, bool sendNotification = true}) → Future<UserTask?>
Creates a UserTask for the AppTask run by executor and enqueues it.
enqueueBufferedTasks() → Future<void>
Enqueues the tasks buffered with buffer, earliest first.
expire(String id) → void
Marks the UserTask with id as expired, unless it is done.
getUserTask(String id) → UserTask?
Returns the UserTask with id, or null if no task is found.
initialize({bool enableNotifications = true}) → Future<void>
Restores the queue of UserTasks from persistent storage.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onNotification(String id) → void
Called when the user taps the OS notification of the UserTask with id.
registerUserTaskFactory(UserTaskFactory factory) → void
Registers factory for each AppTask.type in UserTaskFactory.types.
removeStudy(SmartphoneStudy study) → void
Removes all tasks of study and cancels their notifications.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited