chat_widget library

Classes

BotConfiguration
Configuration for the chatbot widget behavior and appearance.
CarouselConfig
Configuration for carousel component.
ChatAppearance
Tenant-configurable chat-surface colours, mirrored from the backend chat_appearance block on /api/project/config/.
ChatColors
Customisation surface for the chat's visual palette.
ChatHeader
A header widget for the chat interface displaying bot information and controls.
ChatHeaderData
The data + wired action callbacks passed to a ChatHeaderBuilder.
ChatHostAttachment
One attachment a host picker produced, ready to ride as the message's image.
ChatWidget
A floating action button that opens a chat interface with smooth animations.
ChatWidgetState
The state class for ChatWidget, managing chat interactions and animations.
FabConfiguration
Configuration for the floating action button (FAB) that opens the chat.
LocalizedText
Represents a localized text value with translations for different languages
OnTapCallback
Light-weight (callback_id, payload) pair used as the image-tap action on RichImage and ImageComponent. Distinct from RichAction because image taps never need a label or visual style — they just dispatch through the same host-supplied OnCustomCallback channel that buttons use.
ProductListConfig
Configuration for product list component.
RemoteConfig
Remote configuration fetched from the server.
RichAction
Base sealed class for all action types.
RichButton
Button data for button group component.
RichComponent
Base sealed class for all rich content components.
RichContentResponse
Response containing rich content components from the backend.
RichImage
Image data for cards and image components.
RichSwatch
Single swatch in a SwatchGridComponent.
SoundConfiguration
Configuration for chatbot sound effects.
VoiceCallController
Orchestrates one voice call: mints the session on the API, connects to the voice gateway WebSocket, pumps mic audio up and bot audio down, and exposes ValueNotifiers the call UI binds to.
VoiceCallOutcome
How a call finished, and everything that was said in it.
VoiceCallOverlay
Full-panel live voice call surface, per the approved design spec (WidgetChatWeb/voice-chat-design.html): always-dark "different room" takeover with a state-driven orb, live captions, mute / end / keyboard controls, and a docked live-bar when minimized.
VoiceCallView
A live voice call as a standalone screen — the same call the chat composer's mic button opens, without a chat around it.
VoiceCaption
One live caption line.
VoiceConfiguration
Server-driven configuration for live voice chat.
VoiceDebug
Debug hooks for driving a voice call without a microphone.

Enums

ChatHeaderAction
Enum defining available actions in the chat header menu.
SoundEvent
Sound event types that can be triggered.
VoiceCallState
Voice call lifecycle states driving the orb UI.

Extensions

BotConfigurationLocalization on BotConfiguration
BotConfigurationPatterns on BotConfiguration
Adds pattern-matching-related methods to BotConfiguration.
CarouselConfigPatterns on CarouselConfig
Adds pattern-matching-related methods to CarouselConfig.
ChatAppearancePatterns on ChatAppearance
Adds pattern-matching-related methods to ChatAppearance.
FabConfigurationPatterns on FabConfiguration
Adds pattern-matching-related methods to FabConfiguration.
LocalizedTextPatterns on LocalizedText
Adds pattern-matching-related methods to LocalizedText.
OnTapCallbackPatterns on OnTapCallback
Adds pattern-matching-related methods to OnTapCallback.
ProductListConfigPatterns on ProductListConfig
Adds pattern-matching-related methods to ProductListConfig.
RemoteConfigMapping on RemoteConfig
Single canonical mapping from the server/preview config shape (RemoteConfig) to the runtime BotConfiguration. Used by BOTH the real /api/project/config/ fetch (ChatRepository) AND the dashboard live-preview (web_embed parses the postMessage payload via RemoteConfig.fromJson then calls this). Keeping it in one place means a new server config field only has to be added to RemoteConfig
RemoteConfigPatterns on RemoteConfig
Adds pattern-matching-related methods to RemoteConfig.
RichActionPatterns on RichAction
Adds pattern-matching-related methods to RichAction.
RichButtonPatterns on RichButton
Adds pattern-matching-related methods to RichButton.
RichComponentPatterns on RichComponent
Adds pattern-matching-related methods to RichComponent.
RichContentResponsePatterns on RichContentResponse
Adds pattern-matching-related methods to RichContentResponse.
RichImagePatterns on RichImage
Adds pattern-matching-related methods to RichImage.
RichSwatchPatterns on RichSwatch
Adds pattern-matching-related methods to RichSwatch.
SoundConfigurationPatterns on SoundConfiguration
Adds pattern-matching-related methods to SoundConfiguration.
VoiceConfigurationPatterns on VoiceConfiguration
Adds pattern-matching-related methods to VoiceConfiguration.

Functions

labelsByCallbackId(Map<String, String> labels) → ActionLabelResolver
Runs the host's ActionLabelResolver over every action in a rich-content tree and returns the tree with the resolved labels applied.

Typedefs

ActionLabelResolver = String? Function(RichAction action)
Host hook with the final say over the text ON a rendered action — the buttons in a button_group, a card's actions, an image's actions, a swatch's action.
ChatAttachmentPicker = Future<ChatHostAttachment?> Function()
Host-supplied picker offered alongside gallery and camera in the attach sheet.
ChatHeaderBuilder = Widget Function(BuildContext context, ChatHeaderData data)
Signature for ChatWidget.headerBuilder — lets a host app render a fully custom chat header while still driving the SDK's data and actions.
ChatImageUploader = Future<String> Function(Uint8List bytes, String mimeType)
Signature for the host-provided image uploader. Called by ChatViewModel.sendMessage when the user attaches a photo and the host has wired ChatViewModel.imageUploader (or ChatWidget.imageUploader which forwards to it).
HostSlotBuilder = Widget? Function(String slotId, Map<String, dynamic>? payload)
Builder the host registers to render a host_slot component with its own native widget. The SDK calls it with the slot's slotId and payload (carried in the message JSON); return the widget to inline in the bubble.
HostSlotHit = ({Map<String, dynamic> payload, String slotId})
One host_slot a bot reply asked the host to draw: the slot's id and the payload it carries. See ChatViewModel.onBotSlots.
OnCustomCallback = void Function(String callbackId, Map<String, dynamic>? payload)
Callback type for custom actions from rich content.

Exceptions / Errors

VoiceMicPermissionDenied