get method

McpTaskRecord? get(
  1. String? taskId, {
  2. required String? owner,
  3. DateTime? now,
})

The task taskId as owner may see it: null when it does not exist, has expired, or belongs to another authorization context.

Implementation

McpTaskRecord? get(String? taskId, {required String? owner, DateTime? now}) {
  if (taskId == null) return null;
  final t = _tasks[taskId];
  if (t == null) return null;
  if (t.expiredAt(now ?? DateTime.now())) {
    _tasks.remove(taskId);
    return null;
  }
  return t.owner == owner ? t : null;
}