tools property

List<Tool> tools
latefinal

Tools available to this chat, fixed for the chat's lifetime. A cached unmodifiable VIEW over _tools (allocated once, reflects the backing list) — tools.isNotEmpty is read once per generated token on the streaming path, so a per-read List.unmodifiable(_tools) copy would be an O(tools) allocation on the hottest generation loop.

Implementation

late final List<Tool> tools = UnmodifiableListView(_tools);