Task class

State of an asynchronous task (ext-tasks Task / DetailedTask).

The optional variant fields carry status-specific detail inlined by tasks/get and notifications/tasks: inputRequests for input_required, result for completed, error for failed.

Constructors

Task({required String taskId, required TaskStatus status, required String createdAt, required String lastUpdatedAt, String? statusMessage, int? ttlMs, int? pollIntervalMs, Map<String, dynamic>? inputRequests, Map<String, dynamic>? result, Map<String, dynamic>? error})
const
Task.fromJson(Map<String, dynamic> json)
factory

Properties

createdAt String
ISO 8601 creation timestamp.
final
error Map<String, dynamic>?
failed: the JSON-RPC error object.
final
hashCode int
The hash code for this object.
no setterinherited
inputRequests Map<String, dynamic>?
input_required: server→client requests keyed by id (values are the raw CreateMessageRequest/ListRootsRequest/ElicitRequest maps).
final
lastUpdatedAt String
ISO 8601 last-update timestamp.
final
pollIntervalMs int?
Suggested polling interval in integer ms; clients SHOULD honor it.
final
result Map<String, dynamic>?
completed: the terminal result payload.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status TaskStatus
final
statusMessage String?
final
taskId String
final
ttlMs int?
TTL from creation in integer ms; null = unlimited. MAY change over life.
final

Methods

copyWith({TaskStatus? status, String? statusMessage, String? lastUpdatedAt, int? ttlMs, int? pollIntervalMs, Map<String, dynamic>? inputRequests, Map<String, dynamic>? result, Map<String, dynamic>? error}) Task
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toCreateTaskResult({Map<String, dynamic>? meta}) Map<String, dynamic>
CreateTaskResult = Result & Task (flat) with resultType: "task" — the value a server returns in lieu of a standard result when it elects to process the request as a task. meta merges into the result _meta.
toDetailedJson() Map<String, dynamic>
DetailedTask — base fields plus status-specific detail, used by tasks/get and notifications/tasks.
toJson() Map<String, dynamic>
Base Task fields (no status-specific detail). ttlMs is always present per the schema (number | null).
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited