Skip to main content

Flutter Configuration

LovinaChatConfig

The LovinaChatConfig class holds all configuration options for the chat widget.

final config = LovinaChatConfig(
websiteToken: 'your-website-token',
baseUrl: 'https://chat-prod.ailovina.com',
locale: 'en',
colorScheme: 'auto',
user: null,
theme: null,
branding: null,
texts: null,
features: null,
displayMode: 'fullscreen',
);

Fields

ParameterTypeDefaultRequiredDescription
websiteTokenString--YesYour Lovina website token for this agent. Obtained from the Lovina dashboard -- each agent has its own token.
baseUrlString--YesBase URL of your Lovina instance (e.g., https://chat-prod.ailovina.com).
localeString'id'NoWidget locale code. Supported values include 'id', 'en', 'ar'.
colorSchemeString'auto'NoDark mode preference for the widget. Accepts 'light', 'dark', or 'auto' (follows system theme).
userLovinaChatUser?nullNoPre-identified user to associate with the conversation. See below.
themeLovinaThemeConfig?nullNoTheme color, typography, and sizing overrides. Only primaryColor is required in practice -- see Theming.
brandingLovinaBrandingConfig?nullNoWhite-label branding overrides (logo, brand name, "powered by" footer).
textsMap<String, dynamic>?nullNoUI string overrides, keyed by translation key.
featuresLovinaFeatureFlags?nullNoFeature-flag overrides.
displayModeString'fullscreen'NoWidget display mode. Accepts 'popup', 'sidebar', or 'fullscreen'.
hideKeyboardAccessoryBarbooltrueNoSuppress WebKit's keyboard form-assistant bar on iOS while the chat widget is visible. See iOS Keyboard Accessory Bar below.

Theming

Only LovinaThemeConfig.primaryColor is required in practice -- every other color is auto-generated by the widget to meet WCAG AA contrast:

LovinaChatConfig(
websiteToken: 'your-website-token',
baseUrl: 'https://chat-prod.ailovina.com',
theme: LovinaThemeConfig(
primaryColor: '#6366F1',
fontFamily: 'Inter, sans-serif',
bubbleRadius: 16,
),
branding: LovinaBrandingConfig(
brandName: 'Acme Support',
poweredBy: false,
),
);

LovinaChatUser

The LovinaChatUser class represents a pre-identified user.

ParameterTypeRequiredDescription
identifierStringYesUnique user ID in your system.
nameString?NoDisplay name.
emailString?NoEmail address.
avatarUrlString?NoAvatar image URL.
identifierHashString?NoHMAC hash for identity verification. Generate server-side.
phoneNumberString?NoPhone number (E.164 format recommended).
customAttributesMap<String, dynamic>?NoArbitrary key-value metadata attached to the contact.

Event Types

All events extend the ChatEvent base class.

Event ClassPropertiesDescription
ChatLoadedEventauthToken (String?)Widget finished loading.
MessageReceivedEventmessage (Map<String, dynamic>)New message received.
UnreadCountChangedEventcount (int)Unread count changed.
ChatClosedEventreason (String?)Chat was closed.
ChatErrorEventcode (String), message (String)An error occurred.

iOS Keyboard Accessory Bar

hideKeyboardAccessoryBar (default true) suppresses WebKit's keyboard form-assistant bar (Previous/Next/Done) while the chat widget's WebView has focus.

Note: this suppresses the accessory bar for any WebView in your app while the chat is mounted, not just the chat's own. If your app has other WebViews (e.g. an in-app browser), set hideKeyboardAccessoryBar: false to avoid affecting them.

Example: Full Configuration

import 'package:lovina_chat_sdk/lovina_chat_sdk.dart';

final config = LovinaChatConfig(
websiteToken: 'ws-tok-abc123',
baseUrl: 'https://chat-prod.ailovina.com',
locale: 'en',
colorScheme: 'dark',
displayMode: 'fullscreen',
theme: LovinaThemeConfig(
primaryColor: '#6366F1',
),
branding: LovinaBrandingConfig(
brandName: 'Acme Support',
),
user: LovinaChatUser(
identifier: 'user-12345',
name: 'Jane Doe',
email: 'jane@example.com',
avatarUrl: 'https://example.com/avatar.png',
identifierHash: 'hmac-sha256-hash',
phoneNumber: '+6281234567890',
customAttributes: {
'plan': 'premium',
'signup_date': '2025-01-15',
},
),
);