onNotification method
Called when the user taps the OS notification of the UserTask with id.
If the task is enqueued or canceled, moves it to UserTaskState.notified and calls UserTask.onNotification.
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.");
}
}