allows method

bool allows(
  1. String method, {
  2. String? uri,
  3. String? taskId,
})

Whether a notification method (for uri, when it names one) passes.

Implementation

bool allows(String method, {String? uri, String? taskId}) {
  switch (method) {
    case 'notifications/tools/list_changed':
      return toolsListChanged == true;
    case 'notifications/prompts/list_changed':
      return promptsListChanged == true;
    case 'notifications/resources/list_changed':
      return resourcesListChanged == true;
    case 'notifications/resources/updated':
      return uri != null && (resourceSubscriptions ?? const []).contains(uri);
    case 'notifications/tasks':
      return taskId != null && watchedTaskIds.contains(taskId);
    default:
      return false;
  }
}