expire method

void expire(
  1. String id
)

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.

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');
    }
    SmartPhoneClientManager()
        .notificationController
        ?.cancelTaskNotification(userTask);
  }
}