ToolResultMessage.fromJson constructor

ToolResultMessage.fromJson(
  1. Map<String, dynamic> json
)

Deserializes from a JSON map produced by toJson.

Implementation

factory ToolResultMessage.fromJson(Map<String, dynamic> json) =>
    ToolResultMessage(
      toolCallId: json['toolCallId'] as String? ?? '',
      toolName: json['toolName'] as String? ?? '',
      content: [
        for (final block in (json['content'] as List?) ?? const [])
          ContentBlock.fromJson(block as Map<String, dynamic>),
      ],
      isError: json['isError'] as bool? ?? false,
      timestamp: DateTime.fromMillisecondsSinceEpoch(
        json['timestamp'] as int? ?? 0,
      ),
    );