pictureResultOf function

ToolResult pictureResultOf(
  1. Answer answer
)

answer as a tool result: the sentence, then the PNG when there is one.

Implementation

ToolResult pictureResultOf(Answer answer) => ToolResult(
  content: <ToolContent>[
    ToolText(answer.says),
    if (answer.png case final Uint8List png) ToolImage(png),
  ],
  isError: !answer.did,
);