copyWith method

ToolResultContent copyWith({
  1. Map<String, Object?>? meta,
  2. List<ContentBlock>? content,
  3. bool? isError,
  4. Object? structuredContent,
  5. String? toolUseId,
})

A copy with the given properties replaced; everything else, unknown keys included, is kept.

Implementation

ToolResultContent copyWith({
  Map<String, Object?>? meta,
  List<ContentBlock>? content,
  bool? isError,
  Object? structuredContent,
  String? toolUseId,
}) =>
    ToolResultContent.fromJson({
      ...toJson(),
      if (meta != null) '_meta': $encode(meta),
      if (content != null) 'content': $encode(content),
      if (isError != null) 'isError': $encode(isError),
      if (structuredContent != null) 'structuredContent': $encode(structuredContent),
      if (toolUseId != null) 'toolUseId': $encode(toolUseId),
    });