RichComponent.hostSlot constructor
- @FreezedUnionValue.new('host_slot')
A slot the host app fills with its OWN native widget. The bot reserves a
spot in the bubble and names a slotId; the host registers a
HostSlotBuilder on ChatWidget that turns (slotId, payload) into a
Flutter widget. Use it for app-owned inline UI the server can't draw —
e.g. a live PDF preview of a generated document, or a design picker
showing real template thumbnails.
Persistence: chat history reloads re-parse this JSON and regenerate local
message ids, so the host widget MUST be fully re-renderable from payload
alone. Put everything it needs in payload; never key host state on a
local message id. Unknown/unregistered slotIds render as nothing.
Implementation
@FreezedUnionValue('host_slot')
const factory RichComponent.hostSlot({
required String id,
@JsonKey(name: 'slot_id') required String slotId,
Map<String, dynamic>? payload,
}) = HostSlotComponent;