getTask method

Future<Task> getTask(
  1. String taskId
)

Poll a task's current state (tasks/get).

Implementation

Future<Task> getTask(String taskId) async {
  if (!isConnected) throw McpError('Client is not connected to a transport');
  final response = await _sendRequest('tasks/get', {'taskId': taskId});
  if (response == null) throw McpError('tasks/get returned no result');
  return Task.fromJson(Map<String, dynamic>.from(response as Map));
}