done method

void done(
  1. String id, [
  2. Data? result
])

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.

Implementation

void done(String id, [Data? result]) {
  UserTask? userTask = _userTaskMap[id];
  if (userTask == null) {
    warning(
        "$runtimeType - Could not find User Task - id is not valid: '$id'");
  } else {
    userTask.state = UserTaskState.done;
    userTask.result = result;
    _controller.sink.add(userTask);
    info('$runtimeType - Marked $userTask as done');

    SmartPhoneClientManager()
        .notificationController
        ?.cancelTaskNotification(userTask);
  }
}