toTaskJson method
The Task object of this task's specification.
Implementation
Map<String, dynamic> toTaskJson() => {
'taskId': taskId,
'status': status,
if (statusMessage != null) 'statusMessage': statusMessage,
'createdAt': createdAt.toUtc().toIso8601String(),
'lastUpdatedAt': lastUpdatedAt.toUtc().toIso8601String(),
if (flavor == McpTaskFlavor.core) ...{
'ttl': ttlMs,
if (pollIntervalMs != null) 'pollInterval': pollIntervalMs,
} else ...{
'ttlMs': ttlMs,
if (pollIntervalMs != null) 'pollIntervalMs': pollIntervalMs,
},
};