BotConfiguration class abstract

Configuration for the chatbot widget behavior and appearance.

Contains all settings needed to customize the chatbot's functionality, styling, and initial state.

Example:

final config = BotConfiguration(
  userID: 'user123',
  projectSecretKey: 'your-secret-key',
  name: 'Support Bot',
  welcomeMessage: 'Hello! How can I help you?',
);
Available extensions
Annotations
  • @freezed

Constructors

BotConfiguration({required String userID, required String projectSecretKey, LocalizedText? welcomeMessage, LocalizedText? name, LocalizedText? systemInstructions, @Default.new('en') String defaultLocale, @Default.new(['en']) List<String> supportedLocales, String? currentLocale, String? allowedOrigins, @Default.new('Roboto') String? fontFamily, @Default.new('#3B82F6') String? color, @unfreezed Uint8List? avatar, @Default.new(false) bool isPreviewMode, @Default.new(FabConfiguration()) FabConfiguration fabConfiguration})
const
factory

Properties

allowedOrigins String?
Comma-separated list of allowed origins for CORS.
no setterinherited
avatar Uint8List?
Avatar image data. Note: This is excluded from JSON serialization.
no setterinherited
color String?
Primary color for the chat interface in hex format.
no setterinherited
copyWith → $BotConfigurationCopyWith<BotConfiguration>
Create a copy of BotConfiguration with the given fields replaced by the non-null parameter values.
no setterinherited
currentLocale String?
no setterinherited
defaultLocale String
Default locale code for the chat interface (e.g., 'en', 'fr', 'es').
no setterinherited
fabConfiguration FabConfiguration
Configuration for the floating action button appearance.
no setterinherited
fontFamily String?
Font family for chat text. Defaults to 'Roboto'.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isPreviewMode bool
Whether the bot is running in preview mode.
no setterinherited
localizedName String

Available on BotConfiguration, provided by the BotConfigurationLocalization extension

Returns the localized bot name based on the current locale.
no setter
localizedSystemInstructions String

Available on BotConfiguration, provided by the BotConfigurationLocalization extension

Returns the localized system instructions based on the current locale.
no setter
localizedWelcomeMessage String

Available on BotConfiguration, provided by the BotConfigurationLocalization extension

Returns the localized welcome message based on the current locale.
no setter
name LocalizedText?
Display name for the chatbot (localized).
no setterinherited
projectSecretKey String
Secret key for authenticating with the bot service. Keep this secure and never expose in logs.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supportedLocales List<String>
List of supported locale codes
no setterinherited
systemInstructions LocalizedText?
System instructions that guide the bot's behavior (localized).
no setterinherited
userID String
Unique identifier for the user interacting with the bot.
no setterinherited
welcomeMessage LocalizedText?
Initial message displayed when the chat opens (localized).
no setterinherited

Methods

map<TResult extends Object?>(TResult $default(_BotConfiguration value)) → TResult

Available on BotConfiguration, provided by the BotConfigurationPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>(TResult? $default(_BotConfiguration value)?) → TResult?

Available on BotConfiguration, provided by the BotConfigurationPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>(TResult $default(_BotConfiguration value)?, {required TResult orElse()}) → TResult

Available on BotConfiguration, provided by the BotConfigurationPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>(TResult $default(String userID, String projectSecretKey, LocalizedText? welcomeMessage, LocalizedText? name, LocalizedText? systemInstructions, String defaultLocale, List<String> supportedLocales, String? currentLocale, String? allowedOrigins, String? fontFamily, String? color, Uint8List? avatar, bool isPreviewMode, FabConfiguration fabConfiguration)?, {required TResult orElse()}) → TResult

Available on BotConfiguration, provided by the BotConfigurationPatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>(TResult $default(String userID, String projectSecretKey, LocalizedText? welcomeMessage, LocalizedText? name, LocalizedText? systemInstructions, String defaultLocale, List<String> supportedLocales, String? currentLocale, String? allowedOrigins, String? fontFamily, String? color, Uint8List? avatar, bool isPreviewMode, FabConfiguration fabConfiguration)) → TResult

Available on BotConfiguration, provided by the BotConfigurationPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>(TResult? $default(String userID, String projectSecretKey, LocalizedText? welcomeMessage, LocalizedText? name, LocalizedText? systemInstructions, String defaultLocale, List<String> supportedLocales, String? currentLocale, String? allowedOrigins, String? fontFamily, String? color, Uint8List? avatar, bool isPreviewMode, FabConfiguration fabConfiguration)?) → TResult?

Available on BotConfiguration, provided by the BotConfigurationPatterns extension

A variant of when that fallback to returning null

Operators

operator ==(Object other) bool
The equality operator.
inherited