onNotification method

void onNotification(
  1. String id
)

Callback when a notification in the OS is clicked.

Implementation

void onNotification(String id) {
  UserTask? userTask = getUserTask(id);
  if (userTask != null) {
    info('$runtimeType - User Task notification clicked - $userTask');

    // only notify if this task is still active
    if (userTask.state == UserTaskState.enqueued ||
        userTask.state == UserTaskState.canceled) {
      userTask.state = UserTaskState.notified;
      _controller.sink.add(userTask);
      userTask.onNotification();
    }
  } else {
    warning(
        "$runtimeType - Error in callback from notification - no task with id '$id' found.");
  }
}