expire method

void expire(
  1. String id
)

Marks the UserTask with id as expired, unless it is done.

Also cancels its notification.

An expired task stays on the queue. Use dequeue to remove it.

Implementation

void expire(String id) {
  UserTask? userTask = _userTaskMap[id];
  if (userTask == null) {
    warning("$runtimeType - Could not expire AppTask - id is not valid: '$id'");
  } else {
    // only expire tasks which are not already done or expired
    if (userTask.state != UserTaskState.done) {
      userTask.state = UserTaskState.expired;
      _controller.sink.add(userTask);
      info('$runtimeType - Expired $userTask');
    }
    notificationManager.cancelTaskNotification(userTask);
  }
}